Bug 247789 - new-target Syntax Error
Summary: new-target Syntax Error
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yijia Huang
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-11-11 01:20 PST by Kanguk Lee
Modified: 2022-11-15 09:48 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kanguk Lee 2022-11-11 01:20:20 PST
// input.js
class x { static { if ( 0 ?. [ { [ Symbol . toPrimitive ] : x => super [ new . target ( ) ] } ] ** 0 ) ; } }
_____________________________________________________________________________________________________________

Hello,

Executing the input.js using JSC throws SyntaxError, but TypeError is expected.

Running the input.js with JSC results in:

---
$ jsc input.js
Exception: SyntaxError: new.target is not valid inside arrow functions in global code.
at input.js:1
---

while other engines behave like:

---
# V8 (used console.log)
$ node input.js
input.js:1
class x { static { if ( 0 ?. [ { [ Symbol . toPrimitive ] : x => super [ new . target ( ) ] } ] ** 0 ) ; } }
                                                                               ^

TypeError: .new.target is not a function
...

Node.js v18.11.0

# GraalJS
$ js input.js
TypeError: <new.target> is not a function
	at <js> :=>(input.js:1:73-88)
	at <js> :initializer(input.js:1:24-94)
	at <js> :program(input.js:1:0-107)
---


WebKit version: 615.1.10
Comment 1 Radar WebKit Bug Importer 2022-11-14 09:27:39 PST
<rdar://problem/102324348>
Comment 2 Yijia Huang 2022-11-14 18:32:50 PST
Pull request: https://github.com/WebKit/WebKit/pull/6500
Comment 3 EWS 2022-11-15 09:48:27 PST
Committed 256700@main (9a3c9a17863e): <https://commits.webkit.org/256700@main>

Reviewed commits have been landed. Closing PR #6500 and removing active labels.