diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/statements/class/static-init-arguments-methods.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/statements/class/static-init-arguments-methods.js')
-rw-r--r-- | js/src/tests/test262/language/statements/class/static-init-arguments-methods.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/static-init-arguments-methods.js b/js/src/tests/test262/language/statements/class/static-init-arguments-methods.js new file mode 100644 index 0000000000..bb4f12c008 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/static-init-arguments-methods.js @@ -0,0 +1,60 @@ +// 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 identifier `arguments` is not restricted within method forms +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + - It is a Syntax Error if ContainsArguments of ClassStaticBlockStatementList + is true. +includes: [compareArray.js] +features: [class-static-block] +---*/ + +var instance; +var method, methodParam; +var getter; +var setter, setterParam; +var genMethod, genMethodParam; +var asyncMethod, asyncMethodParam; + +class C { + static { + instance = new class { + method({test262 = methodParam = arguments}) { + method = arguments; + } + get accessor() { + getter = arguments; + } + set accessor({test262 = setterParam = arguments}) { + setter = arguments; + } + *gen({test262 = genMethodParam = arguments}) { + genMethod = arguments; + } + async async({test262 = asyncMethodParam = arguments}) { + asyncMethod = arguments; + } + }(); + } +} + +instance.method('method'); +instance.accessor; +instance.accessor = 'setter'; +instance.gen('generator method').next(); +instance.async('async method'); + +assert.compareArray(['method'], method, 'body'); +assert.compareArray(['method'], methodParam, 'parameter'); +assert.compareArray([], getter, 'body'); +assert.compareArray(['setter'], setter, 'body'); +assert.compareArray(['setter'], setterParam, 'parameter'); +assert.compareArray(['generator method'], genMethod, 'body'); +assert.compareArray(['generator method'], genMethodParam, 'parameter'); +assert.compareArray(['async method'], asyncMethod, 'body'); +assert.compareArray(['async method'], asyncMethodParam, 'parameter'); + +reportCompare(0, 0); |