summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-10-02 22:06:32 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-10-02 23:20:03 +0900
commit9059dfce12995451a4374330baab49177fa717be (patch)
tree2c31bbba49d44a5ffe6914044c6a5be2f021b722 /parse.y
parent63e504d6e65765740a592ee785147e5eff0d9aed (diff)
`yield` cannot be placed outside methods even in blocks
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 81f27e91f4..b8bc94cf7c 100644
--- a/parse.y
+++ b/parse.y
@@ -4349,7 +4349,7 @@ k_return : keyword_return
k_yield : keyword_yield
{
- if (!p->ctxt.in_defined && !p->ctxt.in_def && !dyna_in_block(p))
+ if (!p->ctxt.in_defined && !p->ctxt.in_def && !compile_for_eval)
yyerror1(&@1, "Invalid yield");
}
;