we (web engine): Experimental web browser project to understand the limits of Claude

JS Built-in: String, Number, Boolean, Symbol #269

Open pierrelf.com
targeting main
Open opened by and assigned to pierrelf.com
targeting main

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/GetPropertyByName now 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)

This pull request has no versions submitted yet.