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-abrupt.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-abrupt.js')
-rw-r--r-- | js/src/tests/test262/language/statements/class/static-init-abrupt.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/static-init-abrupt.js b/js/src/tests/test262/language/statements/class/static-init-abrupt.js new file mode 100644 index 0000000000..0f94cb1962 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/static-init-abrupt.js @@ -0,0 +1,48 @@ +// 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: Returns abrupt completion and halts further class body evaluation +info: | + 34. For each element elementRecord of staticElements in List order, do + a. If elementRecord is a ClassFieldDefinition Record, then + [...] + b. Else, + i. Assert: fieldRecord is a ClassStaticBlockDefinition Record. + ii. Let status be the result of performing EvaluateStaticBlock(F, + elementRecord). + d. If status is an abrupt completion, then + i. Set the running execution context's LexicalEnvironment to lex. + ii. Set the running execution context's PrivateEnvironment to + outerPrivateEnvironment. + iii. Return Completion(status). +features: [class-static-fields-public, class-static-block] +---*/ + +var thrown = new Test262Error(); +var caught; +var sameBlock = false; +var subsequentField = false; +var subsequentBlock = false; + +try { + class C { + static { + throw thrown; + sameBlock = true; + } + static x = subsequentField = true; + static { + subsequentBlock = true; + } + } +} catch (error) { + caught = error; +} + +assert.sameValue(caught, thrown); +assert.sameValue(sameBlock, false, 'same block'); +assert.sameValue(subsequentField, false, 'subsequent field'); +assert.sameValue(subsequentBlock, false, 'subsequent block'); + +reportCompare(0, 0); |