Debian Codegraph @

js/src/tests/test262/annexB/language/expressions/equals/emulates-undefined.js

raw
1 // Copyright (C) 2020 Alexey Shvayka. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-equality-operators-runtime-semantics-evaluation
5 description: >
6 Abstract Equality special-cases [[IsHTMLDDA]] objects with `undefined` and `null`.
7 info: |
8 EqualityExpression : EqualityExpression == RelationalExpression
9
10 [...]
11 5. Return the result of performing Abstract Equality Comparison rval == lval.
12
13 The [[IsHTMLDDA]] Internal Slot / Changes to Abstract Equality Comparison
14
15 The following steps are inserted after step 3 of the Abstract Equality Comparison algorithm:
16
17 1. If Type(x) is Object and x has an [[IsHTMLDDA]] internal slot and y is either null or undefined, return true.
18 2. If x is either null or undefined and Type(y) is Object and y has an [[IsHTMLDDA]] internal slot, return true.
19 features: [IsHTMLDDA]
20 ---*/
21
22 var IsHTMLDDA = $262.IsHTMLDDA;
23
24 assert(IsHTMLDDA == undefined, "== with `undefined`");
25 assert(undefined == IsHTMLDDA, "== with `undefined`");
26
27 assert(IsHTMLDDA == null, "== with `null`");
28 assert(null == IsHTMLDDA, "== with `null`");
29
30 assert(IsHTMLDDA == IsHTMLDDA);
31
32 reportCompare(0, 0);