diff options
author | eileencodes <eileencodes@gmail.com> | 2023-12-01 14:28:54 -0500 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2023-12-01 12:05:22 -0800 |
commit | 39238888bc784eb5887d899dc09fad30997464ac (patch) | |
tree | 092e798fe03c0020f5e4943eb3ad396487b59aa9 /prism_compile.c | |
parent | ee0eca191f3ca486b6056234add436a8c1488dba (diff) | |
download | ruby-39238888bc784eb5887d899dc09fad30997464ac.tar.gz |
Implements missing literals for `defined?`
This PR implements the following literals:
- String
- Symbols
- Integers
- Floats
- Regexs
- Ranges
- Lambdas
- Hashes
and tests for them.
Diffstat (limited to 'prism_compile.c')
-rw-r--r-- | prism_compile.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/prism_compile.c b/prism_compile.c index 1b55396b0b..e0279db362 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -1465,9 +1465,16 @@ pm_compile_defined_expr0(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *co ADD_INSNL(ret, &dummy_line_node, branchunless, lfinish[1]); } } - case PM_STRING_NODE: case PM_AND_NODE: + case PM_FLOAT_NODE: + case PM_HASH_NODE: + case PM_INTEGER_NODE: + case PM_LAMBDA_NODE: case PM_OR_NODE: + case PM_RANGE_NODE: + case PM_REGULAR_EXPRESSION_NODE: + case PM_STRING_NODE: + case PM_SYMBOL_NODE: dtype = DEFINED_EXPR; break; case PM_LOCAL_VARIABLE_READ_NODE: |