summaryrefslogtreecommitdiff
path: root/py/compile.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-06-19 14:10:29 +1000
committerDamien George <damien.p.george@gmail.com>2018-06-22 17:00:29 +1000
commit36e474e83fa26cb78a9312dce5dc53a467c5d8b7 (patch)
treed68cbd5f1a996c7b61c2620e14c7966b1b0ad726 /py/compile.c
parent1a7109d65aa87596c7ce1824037fe298109962e9 (diff)
py/compile: Combine or_test and and_test compile functions.
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/py/compile.c b/py/compile.c
index 7e8ebfbab..032e0a6ae 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -2024,7 +2024,8 @@ STATIC void compile_lambdef(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_funcdef_lambdef(comp, this_scope, pns->nodes[0], PN_varargslist);
}
-STATIC void compile_or_and_test(compiler_t *comp, mp_parse_node_struct_t *pns, bool cond) {
+STATIC void compile_or_and_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
+ bool cond = MP_PARSE_NODE_STRUCT_KIND(pns) == PN_or_test;
uint l_end = comp_next_label(comp);
int n = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
for (int i = 0; i < n; i += 1) {
@@ -2036,14 +2037,6 @@ STATIC void compile_or_and_test(compiler_t *comp, mp_parse_node_struct_t *pns, b
EMIT_ARG(label_assign, l_end);
}
-STATIC void compile_or_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
- compile_or_and_test(comp, pns, true);
-}
-
-STATIC void compile_and_test(compiler_t *comp, mp_parse_node_struct_t *pns) {
- compile_or_and_test(comp, pns, false);
-}
-
STATIC void compile_not_test_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_node(comp, pns->nodes[0]);
EMIT_ARG(unary_op, MP_UNARY_OP_NOT);