Implements issue 3mhn3nbv6wd2e
Changes #
Adds primitive wrapper built-ins (String, Number, Boolean) and basic Symbol support for the JavaScript engine.
String #
- Constructor and static methods:
String(),fromCharCode(),fromCodePoint() - 26 prototype methods: charAt, charCodeAt, codePointAt, concat, slice, substring, substr, indexOf, lastIndexOf, includes, startsWith, endsWith, trim, trimStart, trimEnd, padStart, padEnd, repeat, split, replace, replaceAll, toLowerCase, toUpperCase, at, toString, valueOf
Number #
- Constructor:
Number()with type coercion - Static methods:
isNaN,isFinite,isInteger,isSafeInteger,parseInt,parseFloat - Constants:
EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,MAX_VALUE,MIN_VALUE,NaN,POSITIVE_INFINITY,NEGATIVE_INFINITY - Prototype:
toString(radix),valueOf,toFixed,toPrecision,toExponential
Boolean #
- Constructor:
Boolean()with truthiness coercion - Prototype:
toString,valueOf
Symbol #
- Factory:
Symbol(description)producing unique string-based identifiers - Well-known symbols:
Symbol.iterator,Symbol.toPrimitive,Symbol.toStringTag,Symbol.hasInstance - Global registry:
Symbol.for(key),Symbol.keyFor(sym)
VM Changes #
- Primitive auto-boxing:
GetProperty/GetPropertyByNamenow look up prototype methods for String, Number, and Boolean values - Global constants:
NaN,Infinity,undefined
Tests #
- 37 new tests covering all built-in categories
- All 328 JS tests pass (291 existing + 37 new)