JsModule { bom_token: missing (optional), interpreter_token: missing (optional), directives: JsDirectiveList [], items: JsModuleItemList [ JsFunctionDeclaration { async_token: missing (optional), function_token: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")], star_token: missing (optional), id: JsIdentifierBinding { name_token: IDENT@9..12 "foo" [] [], }, type_parameters: missing (optional), parameters: JsParameters { l_paren_token: L_PAREN@12..13 "(" [] [], items: JsParameterList [], r_paren_token: R_PAREN@13..15 ")" [] [Whitespace(" ")], }, return_type_annotation: missing (optional), body: JsFunctionBody { l_curly_token: L_CURLY@15..17 "{" [] [Whitespace(" ")], directives: JsDirectiveList [], statements: JsStatementList [ JsExpressionStatement { expression: JsBogusExpression { items: [ YIELD_KW@17..23 "yield" [] [Whitespace(" ")], JsYieldArgument { star_token: missing (optional), expression: JsIdentifierExpression { name: JsReferenceIdentifier { value_token: IDENT@23..26 "bar" [] [], }, }, }, ], }, semicolon_token: SEMICOLON@26..28 ";" [] [Whitespace(" ")], }, ], r_curly_token: R_CURLY@28..29 "}" [] [], }, }, JsFunctionDeclaration { async_token: missing (optional), function_token: FUNCTION_KW@29..39 "function" [Newline("\n")] [Whitespace(" ")], star_token: missing (optional), id: JsIdentifierBinding { name_token: IDENT@39..42 "foo" [] [], }, type_parameters: missing (optional), parameters: JsParameters { l_paren_token: L_PAREN@42..43 "(" [] [], items: JsParameterList [], r_paren_token: R_PAREN@43..45 ")" [] [Whitespace(" ")], }, return_type_annotation: missing (optional), body: JsFunctionBody { l_curly_token: L_CURLY@45..47 "{" [] [Whitespace(" ")], directives: JsDirectiveList [], statements: JsStatementList [ JsExpressionStatement { expression: JsBogusExpression { items: [ YIELD_KW@47..53 "yield" [] [Whitespace(" ")], JsYieldArgument { star_token: missing (optional), expression: JsNumberLiteralExpression { value_token: JS_NUMBER_LITERAL@53..55 "10" [] [], }, }, ], }, semicolon_token: SEMICOLON@55..57 ";" [] [Whitespace(" ")], }, ], r_curly_token: R_CURLY@57..58 "}" [] [], }, }, ], eof_token: EOF@58..59 "" [Newline("\n")] [], } 0: JS_MODULE@0..59 0: (empty) 1: (empty) 2: JS_DIRECTIVE_LIST@0..0 3: JS_MODULE_ITEM_LIST@0..58 0: JS_FUNCTION_DECLARATION@0..29 0: (empty) 1: FUNCTION_KW@0..9 "function" [] [Whitespace(" ")] 2: (empty) 3: JS_IDENTIFIER_BINDING@9..12 0: IDENT@9..12 "foo" [] [] 4: (empty) 5: JS_PARAMETERS@12..15 0: L_PAREN@12..13 "(" [] [] 1: JS_PARAMETER_LIST@13..13 2: R_PAREN@13..15 ")" [] [Whitespace(" ")] 6: (empty) 7: JS_FUNCTION_BODY@15..29 0: L_CURLY@15..17 "{" [] [Whitespace(" ")] 1: JS_DIRECTIVE_LIST@17..17 2: JS_STATEMENT_LIST@17..28 0: JS_EXPRESSION_STATEMENT@17..28 0: JS_BOGUS_EXPRESSION@17..26 0: YIELD_KW@17..23 "yield" [] [Whitespace(" ")] 1: JS_YIELD_ARGUMENT@23..26 0: (empty) 1: JS_IDENTIFIER_EXPRESSION@23..26 0: JS_REFERENCE_IDENTIFIER@23..26 0: IDENT@23..26 "bar" [] [] 1: SEMICOLON@26..28 ";" [] [Whitespace(" ")] 3: R_CURLY@28..29 "}" [] [] 1: JS_FUNCTION_DECLARATION@29..58 0: (empty) 1: FUNCTION_KW@29..39 "function" [Newline("\n")] [Whitespace(" ")] 2: (empty) 3: JS_IDENTIFIER_BINDING@39..42 0: IDENT@39..42 "foo" [] [] 4: (empty) 5: JS_PARAMETERS@42..45 0: L_PAREN@42..43 "(" [] [] 1: JS_PARAMETER_LIST@43..43 2: R_PAREN@43..45 ")" [] [Whitespace(" ")] 6: (empty) 7: JS_FUNCTION_BODY@45..58 0: L_CURLY@45..47 "{" [] [Whitespace(" ")] 1: JS_DIRECTIVE_LIST@47..47 2: JS_STATEMENT_LIST@47..57 0: JS_EXPRESSION_STATEMENT@47..57 0: JS_BOGUS_EXPRESSION@47..55 0: YIELD_KW@47..53 "yield" [] [Whitespace(" ")] 1: JS_YIELD_ARGUMENT@53..55 0: (empty) 1: JS_NUMBER_LITERAL_EXPRESSION@53..55 0: JS_NUMBER_LITERAL@53..55 "10" [] [] 1: SEMICOLON@55..57 ";" [] [Whitespace(" ")] 3: R_CURLY@57..58 "}" [] [] 4: EOF@58..59 "" [Newline("\n")] [] -- yield_in_non_generator_function.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. > 1 │ function foo() { yield bar; } │ ^^^^^ 2 │ function foo() { yield 10; } 3 │ -- yield_in_non_generator_function.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. 1 │ function foo() { yield bar; } > 2 │ function foo() { yield 10; } │ ^^^^^ 3 │ -- function foo() { yield bar; } function foo() { yield 10; }