Bug 247437 - `toString` of a generator function is wrong
Summary: `toString` of a generator function is wrong
Status: RESOLVED DUPLICATE of bug 190501
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 247438 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-11-03 09:18 PDT by Kanguk Lee
Modified: 2023-09-27 13:19 PDT (History)
4 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-03 09:18:58 PDT
// input.js
print (
    String(function * () {})
);
__________________________

Hello,

The space between `function` and `*` should be retained in the result of toString of the generator function, but JSC removes all the space between them.

Running the input.js with JSC prints:

---
$ jsc input.js
function* () {}
---

while other engines behave like:

---
# V8 (used console.log)
$ node input.js
function * () {}

# GraalJS
$ js input.js
function * () {}
---


WebKit version: 615.1.10
Comment 1 Radar WebKit Bug Importer 2022-11-07 16:31:59 PST
<rdar://problem/102065151>
Comment 2 Yusuke Suzuki 2022-11-10 10:50:23 PST
*** Bug 247438 has been marked as a duplicate of this bug. ***
Comment 3 Yusuke Suzuki 2022-11-10 10:50:34 PST
This is Function#toString thing feature, which is not implemented.
Comment 4 Alexey Shvayka 2023-09-27 13:19:03 PDT

*** This bug has been marked as a duplicate of bug 190501 ***