Implement the JavaScript object model with prototype-based inheritance.
Scope#
Build the core object system that underpins all JavaScript values: property storage, prototype chain lookup, and type-related operators.
Object Representation#
- Property map: string keys → property descriptors
- Data properties: value, writable, enumerable, configurable
- Accessor properties: get/set functions, enumerable, configurable
- Internal slots: [[Prototype]], [[Extensible]]
- Computed property keys (string and symbol)
Prototype Chain#
- [[Get]]: walk prototype chain for property lookup
- [[Set]]: set own property (respecting writable, setter)
- [[HasProperty]]: check own + prototype chain
- [[Delete]]: delete own property (respecting configurable)
- Object.create() semantics: create object with given prototype
- Object.getPrototypeOf / Object.setPrototypeOf
Operators#
typeof— return type string ("undefined", "object", "boolean", "number", "string", "function", "symbol")instanceof— walk prototype chain checking against constructor.prototypeinoperator — [[HasProperty]] checkdeleteoperator — [[Delete]] on property
Property Enumeration#
for...inenumeration (own + inherited enumerable string properties)- Own property enumeration order (integer indices first, then insertion order)
Acceptance Criteria#
- Object type with property map and prototype pointer
- Property descriptors (data and accessor)
- Prototype chain lookup for property access
-
typeofreturns correct strings for all types -
instanceofwalks prototype chain correctly -
inoperator works for own and inherited properties -
deleteoperator respects configurable flag - Property enumeration in correct order
- Object.create with null prototype works
- Unit tests for prototype chain, property descriptors, operators
Phase 10 — JavaScript Engine (issue 6 of 15). Depends on: JS Garbage Collector.