mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[PRISM] yield is invalid inside eval
This commit is contained in:
parent
0285b533e9
commit
f70a4a0336
1 changed files with 9 additions and 0 deletions
|
@ -7960,6 +7960,15 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret,
|
|||
case PM_YIELD_NODE: {
|
||||
pm_yield_node_t *yield_node = (pm_yield_node_t *)node;
|
||||
|
||||
switch (ISEQ_BODY(ISEQ_BODY(iseq)->local_iseq)->type) {
|
||||
case ISEQ_TYPE_TOP:
|
||||
case ISEQ_TYPE_MAIN:
|
||||
case ISEQ_TYPE_CLASS:
|
||||
COMPILE_ERROR(ERROR_ARGS "Invalid yield");
|
||||
return;
|
||||
default: /* valid */;
|
||||
}
|
||||
|
||||
int flags = 0;
|
||||
struct rb_callinfo_kwarg *keywords = NULL;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue