aboutsummaryrefslogtreecommitdiffstats
path: root/prism_compile.c
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2023-12-01 14:28:54 -0500
committerAaron Patterson <aaron.patterson@gmail.com>2023-12-01 12:05:22 -0800
commit39238888bc784eb5887d899dc09fad30997464ac (patch)
tree092e798fe03c0020f5e4943eb3ad396487b59aa9 /prism_compile.c
parentee0eca191f3ca486b6056234add436a8c1488dba (diff)
downloadruby-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.c9
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: