Skip to content

XS: Map methods throw when the key argument is omitted #1666

Description

@d01c2

Build environment: macOS 26.5.2

Moddable SDK version:

  • Installed via jsvu, so there is no SDK source tree / git describe.
  • Engine reports: XS 17.9.1, slot 32 bytes, ID 4 bytes

Target device: desktop (host xs)

Description
Map.prototype.get throws when the key argument is omitted. The same behavior occurs with Map.prototype.has, Map.prototype.delete, and Map.prototype.set.

An omitted argument supplies undefined, which is a valid Map key, so these methods should behave as if undefined were passed explicitly.

Steps to Reproduce

$ xst -e "Map.prototype.get.call(new Map());"
TypeError: no key (in Map.prototype.get)

Expected behavior
undefined is returned without an exception.

For comparison, V8 (15.3.27):

$ v8 -e "print(String(Map.prototype.get.call(new Map())))"
undefined

Other information
XS already produces the expected result when undefined is passed explicitly:

$ xst -e "print(String(Map.prototype.get.call(new Map(), undefined)))"
undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    conformancebehavior does not match standard

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions