Some checks failed
ci / fast (linux) (push) Failing after 11m14s
Add the JSON global object with both methods following the sentinel NativeFunction + interpreter interception pattern. The implementation includes a dedicated recursive descent JSON parser (strict spec: no trailing commas, no single quotes, no hex/octal, surrogate pair support), JSON.stringify with replacer function/array, space indentation, toJSON, boxed primitive unwrapping, and circular reference detection via ptr_eq. Safety: depth-limited to 512 levels for both parse and stringify to prevent stack overflow from malicious input. Space string truncation uses char boundaries to avoid panics on multi-byte UTF-8. 138 unit tests, 2 conformance tests (js262). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
11 KiB
11 KiB
JavaScript Feature Matrix
Status of JS language features in the custom interpreter (js_parser + js_vm).
Legend
| Status | Meaning |
|---|---|
| Supported | Feature works and has conformance tests |
| Not Supported | Feature not yet implemented (tracked as known_fail) |
| Partial | Some sub-features work, others don't |
Language Core
| Feature | Status | Conformance Tests | Known Failures | Notes |
|---|---|---|---|---|
var declarations |
Supported | 11 | 0 | Hoisting, function scope, block visibility |
let declarations |
Supported | (in var-decl tests) | 0 | Block scoping, TDZ |
const declarations |
Supported | (in var-decl tests) | 0 | Immutability enforced |
| Number literals | Supported | (in expr tests) | 0 | IEEE 754 f64 |
| String literals | Supported | (in expr tests) | 0 | UTF-8, escape sequences |
| Boolean literals | Supported | (in type tests) | 0 | |
null / undefined |
Supported | (in type tests) | 0 | |
| Arithmetic operators | Supported | 16 | 0 | +, -, *, /, % with coercion |
| Comparison operators | Supported | (in expr tests) | 0 | ==, ===, !=, !==, <, >, <=, >= |
| Unary operators | Supported | (in expr tests) | 0 | typeof, delete, void, -, ! |
| Logical operators | Supported | 2 | 0 | &&, || with short-circuit evaluation |
| Bitwise operators | Supported | 33 | 0 | &, |, ^, ~, <<, >>, >>> |
| Ternary operator | Supported | 4 | 0 | ? : |
| Exponentiation operator | Supported | 2 | 19 | **, **= (ES2016) |
| Nullish coalescing | Supported | 1 | 0 | ?? (ES2020) |
| Logical assignment | Supported | 6 | 0 | &&=, ||=, ??= (ES2021) |
| Compound assignment | Supported | 1 | 0 | +=, -=, *=, **=, &=, |=, ^=, <<=, >>=, >>>= |
| Increment/decrement | Supported | 1 | 0 | ++, -- (prefix and postfix) |
| Computed member access | Supported | 1 | 0 | obj[key] |
instanceof |
Supported | 2 | 0 | Walks prototype chain |
in operator |
Supported | 1 | 0 | Walks prototype chain |
delete operator |
Supported | 1 | 0 | Member, computed, identifier |
void operator |
Supported | 1 | 0 | Returns undefined |
| ToPrimitive (valueOf/toString coercion) | Supported | (in test262 tests) | 0 | [Symbol.toPrimitive], valueOf(), toString() hint-based coercion |
Wrapper objects (new Number/String/Boolean) |
Supported | (in test262 tests) | 0 | new Number(), new String(), new Boolean() with valueOf()/toString() |
class declarations |
Supported | 10 | 0 | constructor, methods, extends, super(), super.method(), static |
| Template literals | Supported | 24 | 0 | `${expr}` |
if/else |
Supported | 6 | 0 | Nested, truthiness rules |
for loops |
Supported | 6 | 0 | for (init; test; update), break, continue, let scoping |
for...in |
Supported | 20 | 0 | Object key enumeration incl. prototype chain, arrays, break/continue, let/const scoping |
for...of |
Partial | 19 | 0 | Arrays and strings only; no general iterator protocol yet |
while loops |
Supported | 3 | 0 | break, continue |
do...while loops |
Supported | 2 | 0 | Executes body at least once |
switch |
Supported | 1 | 0 | Basic matching, fall-through, break, default |
| Function declarations | Supported | 10 | 0 | Hoisting, recursion, closures |
| Function expressions | Supported | (in func tests) | 0 | Named and anonymous |
| Arrow functions | Supported | 3 | 0 | Expression/block body, lexical this, new rejection |
try/catch/finally |
Supported | 5 | 0 | All clause combinations, catch param scoping |
throw |
Supported | (in try-catch tests) | 0 | Throw + catch integration |
| Array literals + methods | Supported | 19 | 0 | [1,2,3], Array.isArray(), .push(), .pop(), .join(), .indexOf(), .lastIndexOf(), .includes(), .slice(), .concat(), .reverse(), .shift(), .unshift(), .map(), .forEach(), .filter(), .find(), .findIndex(), .some(), .every(), .reduce(), .reduceRight(), .sort(), .toString() |
| Object literals | Supported | 9 | 0 | Creation, dot access, assignment, nesting, Object.keys/values/entries, Object.create, Object.getPrototypeOf, Object.assign |
this keyword |
Supported | 5 | 0 | Global scope, constructors, method calls |
| String methods | Supported | 3 | 0 | .length, .charAt(), .indexOf(), .slice(), etc. (ASCII-focused, chars() indexing) |
Function.name / .call() |
Supported | 1 | 0 | Direct member-call only (fn.call(thisArg, ...)) |
Object.prototype.toString |
Supported | 1 | 0 | Object.prototype.toString.call(value) type tagging |
hasOwnProperty / propertyIsEnumerable |
Supported | 2 | 0 | Own vs inherited, enumerable check; works on objects and functions |
| Non-enumerable properties | Supported | (internal) | 0 | Builtin prototype methods non-enumerable; for...in / Object.keys() / spread respect it |
| Function properties | Supported | (in test262 tests) | 0 | fn.prop = val, fn.prop, fn.method() |
Spread / rest ... |
Supported | 6 | 0 | Arrays, strings, function args/params, object spread, Symbol.iterator iterables; object spread key order non-deterministic for non-numeric keys |
| Destructuring | Supported | 8 | 0 | Array/object patterns in let/const/var, defaults, holes, rest, nesting, renaming, function params, arrow params, assignment, for-of/in; shorthand properties {x} and array elisions [1,,3] |
typeof |
Supported | 5 | 0 | All value types |
Strict mode ("use strict") |
Supported | 35 | 0 | Program/function/arrow/class; directive prologue detection, has_escape guard, reserved words, duplicate params, non-simple params, delete identifier, this binding, .call() coercion |
eval() |
Supported | 3 | 0 | Direct eval with scope access, indirect eval, strict mode isolation, parse errors as SyntaxError |
RegExp |
Supported | 41 | 0 | Regex literals, RegExp constructor, test(), exec(), toString(), flags (g, i, m, s, u, y), lastIndex, String.prototype.match/search/replace/split with regex; no function replacers, no matchAll/replaceAll, no $<name> named group substitution |
Symbol |
Supported | 25 | 0 | Unique identity, .description, .toString(), Symbol.for()/Symbol.keyFor(), symbol-keyed properties, Object.getOwnPropertySymbols(), well-known symbols (iterator, toPrimitive, hasInstance, toStringTag, species, isConcatSpreadable) |
WeakMap |
Supported | 11 | 0 | new WeakMap(), .get()/.set()/.has()/.delete(), object-key-only enforcement, .set() returns this for chaining |
Proxy |
Supported | 17 | 0 | new Proxy(target, handler), get/set/has/deleteProperty/apply traps, Proxy.revocable(), function proxy targets |
JSON |
Supported | 2 | 0 | JSON.stringify() (replacer function/array, space, toJSON, circular detection, boxed primitives), JSON.parse() (reviver, strict JSON spec) |
Web APIs (DOM / Events / Scheduling)
| Feature | Status | Conformance Tests | Known Failures | Notes |
|---|---|---|---|---|
document.getElementById() |
Supported | 6 | 0 | Returns null for missing |
document.createElement() |
Supported | (in dom tests) | 0 | |
element.appendChild() |
Supported | (in dom tests) | 0 | Returns appended child |
element.removeChild() |
Supported | (in dom tests) | 0 | Error if not a child |
element.textContent |
Supported | (in dom tests) | 0 | Get and set |
element.addEventListener() |
Supported | 6 | 0 | Click events, bubbling |
element.removeEventListener() |
Supported | (in event tests) | 0 | |
event.preventDefault() |
Supported | (in event tests) | 0 | |
event.stopPropagation() |
Supported | (in event tests) | 0 | |
event.type |
Supported | (in event tests) | 0 | |
setTimeout() |
Supported | 7 | 0 | Deterministic virtual clock |
clearTimeout() |
Supported | (in sched tests) | 0 | |
queueMicrotask() |
Supported | (in sched tests) | 0 | |
Promise constructor |
Supported | 5 | 0 | new Promise(fn) |
Promise.resolve() |
Supported | (in promise tests) | 0 | |
Promise.reject() |
Supported | (in promise tests) | 0 | |
.then() / .catch() |
Supported | (in promise tests) | 0 | Chaining, error recovery |
console.log() |
Supported | (in unit tests) | 0 | Capture sink for testing |
Error Handling
| Error Type | Status | Notes |
|---|---|---|
ReferenceError |
Supported | Undeclared variables, TDZ |
TypeError |
Supported | Null property access, non-function calls, const assignment |
ParseError |
Supported | Syntax errors |
RuntimeError |
Supported | Statement limit exceeded |
| Source locations | Supported | Line:col in error messages |
Error Constructors (29 unit tests, 3 js262 tests)
| Constructor | Status | Notes |
|---|---|---|
Error |
Supported | Constructor, toString, instanceof, call-without-new |
TypeError |
Supported | Prototype chain → Error.prototype |
ReferenceError |
Supported | Prototype chain → Error.prototype |
SyntaxError |
Supported | Prototype chain → Error.prototype |
RangeError |
Supported | Prototype chain → Error.prototype |
EvalError |
Supported | Prototype chain → Error.prototype |
URIError |
Supported | Prototype chain → Error.prototype |
| Internal → Error objects | Supported | Caught runtime errors are proper Error objects with instanceof |
Test Counts Summary
| Category | Pass | Known Fail | Total |
|---|---|---|---|
| JS262 conformance | 569 | 165 | 735 |
| Integration (js_tests) | 45 | — | 45 |
| Integration (js_dom_tests) | 25 | — | 25 |
| Integration (js_events) | 14 | — | 14 |
| Integration (js_scheduling) | 24 | — | 24 |
| Unit (js_vm interpreter) | 631 | — | 631 |
| Unit (js_vm value) | 97 | — | 97 |
| Unit (js_vm other) | 61 | — | 61 |
| Unit (js_parser) | 324 | — | 324 |
| Unit (js_parser tokenizer) | 88 | — | 88 |
| Unit (js_parser token) | 18 | — | 18 |
| Unit (js crate) | 28 | — | 28 |
| Unit (web_api) | 111 | — | 111 |
| Total | 1658 | 16 | 1674 |
Test262 Coverage (Phase B)
550 real Test262 tests vendored from tc39/test262 and run via mode = "test262" in the JS262 harness.
These are in addition to the hand-written conformance tests counted above.
| Feature Area | Pass | Known Fail | Total |
|---|---|---|---|
| asi | 20 | 5 | 25 |
| block-scope | 30 | 9 | 39 |
| comments | 15 | 0 | 15 |
| computed-property-names | 0 | 18 | 18 |
| destructuring | 11 | 3 | 14 |
| directive-prologue | 14 | 11 | 25 |
| expressions | 173 | 241 | 414 |
| Total | 263 | 287 | 550 |
Pass rate: 70% (up from 47.8%)
See docs/test262_roadmap.md for the integration plan and docs/js_conformance_report.md for known-fail details.