OLD | NEW |
---|---|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | 2 |
3 /* | 3 /* |
4 * Any copyright is dedicated to the Public Domain. | 4 * Any copyright is dedicated to the Public Domain. |
5 * http://creativecommons.org/licenses/publicdomain/ | 5 * http://creativecommons.org/licenses/publicdomain/ |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 /* | 9 /* |
10 * Return true if both of these return true: | 10 * Return true if both of these return true: |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 */ | 87 */ |
88 function parseRaisesException(exception) { | 88 function parseRaisesException(exception) { |
89 return function (code) { | 89 return function (code) { |
90 shouldThrowType("Function("+JSON.stringify(code)+")", exception); | 90 shouldThrowType("Function("+JSON.stringify(code)+")", exception); |
91 return true; | 91 return true; |
92 }; | 92 }; |
93 }; | 93 }; |
94 | 94 |
95 /* | 95 /* |
96 * Return the result of applying uneval to VAL, and replacing all runs | 96 * Return the result of applying uneval to VAL, and replacing all runs |
97 * of whitespace with a single horizontal space (poor man's | 97 * of whitespace with a single horizontal space (simple tokenization). |
Matt Giuca
2016/11/29 06:45:43
Note: Not sure if we're supposed to change these o
Nico
2016/11/29 16:17:07
I don't know either, but I assume it's fine for th
| |
98 * tokenization). | |
99 */ | 98 */ |
100 function clean_uneval(val) { | 99 function clean_uneval(val) { |
101 return uneval(val).replace(/\s+/g, ' '); | 100 return uneval(val).replace(/\s+/g, ' '); |
102 } | 101 } |
103 | 102 |
104 /* | 103 /* |
105 * Return true if A is equal to B, where equality on arrays and objects | 104 * Return true if A is equal to B, where equality on arrays and objects |
106 * means that they have the same set of enumerable properties, the values | 105 * means that they have the same set of enumerable properties, the values |
107 * of each property are deep_equal, and their 'length' properties are | 106 * of each property are deep_equal, and their 'length' properties are |
108 * equal. Equality on other types is ==. | 107 * equal. Equality on other types is ==. |
(...skipping 21 matching lines...) Expand all Loading... | |
130 if (a === b) { | 129 if (a === b) { |
131 // Distinguish 0 from -0, even though they are ===. | 130 // Distinguish 0 from -0, even though they are ===. |
132 return a !== 0 || 1/a === 1/b; | 131 return a !== 0 || 1/a === 1/b; |
133 } | 132 } |
134 | 133 |
135 // Treat NaNs as equal, even though NaN !== NaN. | 134 // Treat NaNs as equal, even though NaN !== NaN. |
136 // NaNs are the only non-reflexive values, i.e., if a !== a, then a is a NaN . | 135 // NaNs are the only non-reflexive values, i.e., if a !== a, then a is a NaN . |
137 // isNaN is broken: it converts its argument to number, so isNaN("foo") => t rue | 136 // isNaN is broken: it converts its argument to number, so isNaN("foo") => t rue |
138 return a !== a && b !== b; | 137 return a !== a && b !== b; |
139 } | 138 } |
OLD | NEW |