Skip to content

RegExp accessor getters: throw TypeError on non-object this #614

@frostney

Description

@frostney

Summary

RegExp.prototype accessor getters should throw TypeError for primitive this values (null, undefined, number, etc.).

Why

9 test262 this-val-invalid-obj tests fail across all flag getters.

Current behavior

Getters pass primitives through to IsRegExpValue which returns false, throwing a generic error.

Expected behavior

Calling the getter with a primitive this throws TypeError immediately per ES2026 §22.2.6.*.

Scope notes

  • Source: Goccia.Builtins.GlobalRegExp.pas RequireRegExpThis
  • Add explicit is-object check before the IsRegExpValue call

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineTGocciaEngine: language semantics, ECMAScript built-ins, parser, interpreter, bytecode VMspec complianceMismatch against official JavaScript/TypeScript specification

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions