Skip to content

A rejected STRICT ordinary-object write never throws — the mirror image of #9394 on the object path #9422

Description

@proggeramlug
"use strict";
const o = { x: 1 };
Object.freeze(o);
o.x = 9;      // node: TypeError   perry: silent

Per ES §6.2.5.7, a failed [[Set]] must throw in strict mode. Perry is silent.

Root cause, already located

Codegen emits js_put_value_set(..., strict = 0) at every property-set site (crates/perry-codegen/src/expr/property_set.rs:348 and :479). The strictness flag exists and is threaded elsewhere — it simply is not passed here.

Relationship to #9394

Exact mirror image. #9394 was the array element path throwing in sloppy mode where node is silent; this is the ordinary-object path staying silent in strict mode where node throws. #9418 fixed the array side by carrying the assignment's own Throw flag, which codegen already had — the same flag is what this needs.

Deliberately kept out of #9418's scope so a correctness fix for one path did not silently change the other; the fixture there asserts the object control in the sloppy arm only, with a comment pointing here.

Test guidance

Assert both arms — strict throws and sloppy stays silent — for frozen, sealed, non-extensible and non-writable-descriptor receivers. Asserting only one arm is precisely what let #9394 through.

Found while fixing #9394.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions