Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 36f50aab423c74d3b9b941e41a49b7ca2d581668 https://github.com/WebKit/WebKit/commit/36f50aab423c74d3b9b941e41a49b7ca2d581668 Author: Dan Hecht <dan.he...@apple.com> Date: 2024-07-10 (Wed, 10 Jul 2024)
Changed paths: A JSTests/stress/yield-await-class-field-initializer-expr.js M Source/JavaScriptCore/parser/Parser.cpp Log Message: ----------- [JSC] Disallow yield/await expressions in class field initializers https://bugs.webkit.org/show_bug.cgi?id=276438 rdar://119044881 Reviewed by Yusuke Suzuki. The language spec doesn't explictly disallow yield and await expressions in class field initializers, however it implicitly does given that the expression is effectively evaluated as if it's inside a method. Additionally, the consensus seems to be that these expressions should not be allowed, see: https://github.com/tc39/ecma262/issues/3333 The yield and await expressions are now handled differently, but similar to how they are each handled in other contexts. This also seems to be the least disruptive way to handle existing scripts, as well as consistent with other engines: yield: raise syntax error await: parse as an identifier Also adding a new test that generates and verifies scripts containing a class with a field initializer containing yield and await, where the class is either not nested or nested inside generator or async functions to verify the behavior of various combinations. * Source/JavaScriptCore/parser/Parser.cpp: (JSC::Parser<LexerType>::parseYieldExpression): (JSC::Parser<LexerType>::parseAwaitExpression): (JSC::Parser<LexerType>::parsePrimaryExpression): (JSC::Parser<LexerType>::parseUnaryExpression): Canonical link: https://commits.webkit.org/280837@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes