Debian Codegraph @

js/src/tests/test262/annexB/language/expressions/does-not-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. Let r be the result of performing Abstract Equality Comparison rval == lval.
12 6. ReturnIfAbrupt(r).
13 7. If r is true, return false. Otherwise, return true.
14
15 The [[IsHTMLDDA]] Internal Slot / Changes to Abstract Equality Comparison
16
17 The following steps are inserted after step 3 of the Abstract Equality Comparison algorithm:
18
19 1. If Type(x) is Object and x has an [[IsHTMLDDA]] internal slot and y is either null or undefined, return true.
20 2. If x is either null or undefined and Type(y) is Object and y has an [[IsHTMLDDA]] internal slot, return true.
21 features: [IsHTMLDDA]
22 ---*/
23
24 var IsHTMLDDA = $262.IsHTMLDDA;
25
26 assert.sameValue(IsHTMLDDA != undefined, false, "!= with `undefined`");
27 assert.sameValue(undefined != IsHTMLDDA, false, "!= with `undefined`");
28
29 assert.sameValue(IsHTMLDDA != null, false, "!= with `null`");
30 assert.sameValue(null != IsHTMLDDA, false, "!= with `null`");
31
32 assert.sameValue(IsHTMLDDA != IsHTMLDDA, false);
33
34 reportCompare(0, 0);