All checks were successful
ci / fast (linux) (push) Successful in 6m23s
Implement ECMA-262 §7.1.1 ToPrimitive/OrdinaryToPrimitive algorithm with valueOf/toString method dispatch, wrapper objects via new Number/String/Boolean, bare-call semantics (Number(42) → primitive), and primitive auto-boxing for method calls like (42).toString(). Updates all operator coercion points (arithmetic, comparison, equality, bitwise, unary, update, compound assignment, template literals) to use ToPrimitive. Promotes 440+ Test262 tests to pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7 lines
155 B
JavaScript
7 lines
155 B
JavaScript
// ToPrimitive via valueOf
|
|
var o = {valueOf: function() { return 42; }};
|
|
console.log(o + 1);
|
|
console.log(o - 1);
|
|
console.log(o * 2);
|
|
console.log(o == 42);
|