| Summary: | output of toString() of Generator is wrong | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | sunlili | ||||
| Component: | JavaScriptCore | Assignee: | Yusuke Suzuki <ysuzuki> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | ews-watchlist, fpizlo, keith_miller, mark.lam, msaboff, saam, webkit-bug-importer, ysuzuki | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Local Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
Created attachment 348511 [details]
Patch
Comment on attachment 348511 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=348511&action=review r=me > Source/JavaScriptCore/runtime/FunctionPrototype.cpp:136 > + case SourceParseMode::AsyncGeneratorWrapperMethodMode: Shouldn't this async generator method be "async* " since that's the syntax? Comment on attachment 348511 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=348511&action=review Thanks! >> Source/JavaScriptCore/runtime/FunctionPrototype.cpp:136 >> + case SourceParseMode::AsyncGeneratorWrapperMethodMode: > > Shouldn't this async generator method be "async* " since that's the syntax? Right now, we always emit `async function* ...` even for async generator methods, as we emit `function xxx() { }` for methods. When https://tc39.github.io/Function-prototype-toString-revision/ is integrated into JSC, we should revisit these cases. |
Executing following code : -------------------------------------- var f = function* () {} print(f.toString()); -------------------------------------- Output of JavaScriptCore is : function () {} However, the output should be : function* () {} BT group 2018.08.26