Bug 247493 - Order between initializing x and this.x in strict mode
Summary: Order between initializing x and this.x in strict mode
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Mac (Apple Silicon) macOS 12
: P2 Normal
Assignee: Yijia Huang
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-11-04 09:59 PDT by Kanguk Lee
Modified: 2022-11-14 11:03 PST (History)
3 users (show)

See Also:


Attachments
I captured ECMAScript 2022 section 13.15.2. (1.28 MB, image/png)
2022-11-04 09:59 PDT, Kanguk Lee
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kanguk Lee 2022-11-04 09:59:29 PDT
Created attachment 463411 [details]
I captured ECMAScript 2022 section 13.15.2.

// input.js
"use strict";
x = this.x = 0;
________________________________

Hello,

Executing the input.js using JSC terminates normally, but it is expected to throw ReferenceError.

According to ECMAScript 2022 section 13.15.2: Evaluation of `*AssignmentExpression* : *LeftHandSideExpression* = *AssignmentExpression*`,

(link: https://tc39.es/ecma262/2022/multipage/ecmascript-language-expressions.html#sec-assignment-operators-runtime-semantics-evaluation)

in line 1-a, *LeftHandSideExpression*, i.e. `x` should be evaluated first and the evaluation result is an unresolvable reference.

Therefore PutValue() in line 1-e throws ReferenceError because strict mode is turned on.


WebKit version: 615.1.10
Comment 1 Radar WebKit Bug Importer 2022-11-07 16:24:45 PST
<rdar://problem/102064848>
Comment 2 Yijia Huang 2022-11-13 00:15:36 PST
Pull request: https://github.com/WebKit/WebKit/pull/6438
Comment 3 Yusuke Suzuki 2022-11-14 11:03:47 PST
Ross pointed out that this is spec issue actually.
https://github.com/WebKit/WebKit/pull/6438#issuecomment-1312694884
https://github.com/WebKit/WebKit/pull/6438#issuecomment-1312922522
We close this since the spec will be upgraded.