Debian Codegraph @

js/src/tests/test262/language/expressions/optional-chaining/runtime-semantics-evaluation.js

raw
1 // Copyright 2019 Google, Inc. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: prod-OptionalExpression
5 description: >
6 accessing optional value on undefined or null returns undefined.
7 info: |
8 If baseValue is undefined or null, then
9 Return undefined.
10 features: [optional-chaining]
11 ---*/
12
13 const nul = null;
14 const undf = undefined;
15 assert.sameValue(undefined, nul?.a);
16 assert.sameValue(undefined, undf?.b);
17 assert.sameValue(undefined, null?.a);
18 assert.sameValue(undefined, undefined?.b);
19
20 reportCompare(0, 0);