Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Add early error for yield in GeneratorExpression parameters #2413

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion boa_engine/src/string/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,6 @@ impl ToStringEscaped for [u16] {
mod tests {
use super::utf16;
use super::{JsString, JsStringPtrKind};
use std::mem::size_of;

impl JsString {
/// Gets the number of `JsString`s which point to this allocation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ where
params_start_position,
)?;

// It is a Syntax Error if FormalParameters Contains YieldExpression is true.
Copy link
Member

@jasonwilliams jasonwilliams Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// https://tc39.es/ecma262/#sec-generator-function-definitions-static-semantics-early-errors

I think the above comment is also pointing to function definitions not generator function definitions which is slightly different.

if contains(&params, ContainsSymbol::YieldExpression) {
return Err(Error::lex(LexError::Syntax(
"generator expression cannot contain yield expression in parameters".into(),
params_start_position,
)));
}

let function = Generator::new(name, params, body, has_binding_identifier);

if contains(&function, ContainsSymbol::Super) {
Expand Down