diff options
author | Kevin Newton <kddnewton@gmail.com> | 2023-09-28 10:51:57 -0400 |
---|---|---|
committer | Kevin Newton <kddnewton@gmail.com> | 2023-09-29 09:51:23 -0400 |
commit | 38e3cafe62637b138700e04a8a6a1ee73fe5a5f2 (patch) | |
tree | 7b2347aa1ff1c578ff0ecb17954f1d28f67c5ca1 /prism_compile.c | |
parent | 396042a25c6c8f84cd08f9e5f10d46b834802c9f (diff) | |
download | ruby-38e3cafe62637b138700e04a8a6a1ee73fe5a5f2.tar.gz |
Compile implicit nodes
Diffstat (limited to 'prism_compile.c')
-rw-r--r-- | prism_compile.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/prism_compile.c b/prism_compile.c index b4c5fc89df..9f736ebdc4 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -1512,6 +1512,19 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, } return; } + case PM_IMPLICIT_NODE: { + // Implicit nodes mark places in the syntax tree where explicit syntax + // was omitted, but implied. For example, + // + // { foo: } + // + // In this case a method call/local variable read is implied by virtue + // of the missing value. To compile these nodes, we simply compile the + // value that is implied, which is helpfully supplied by the parser. + pm_implicit_node_t *cast = (pm_implicit_node_t *)node; + PM_COMPILE(cast->value); + return; + } case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: { pm_instance_variable_and_write_node_t *instance_variable_and_write_node = (pm_instance_variable_and_write_node_t*) node; |