aboutsummaryrefslogtreecommitdiff
path: root/std.py
diff options
context:
space:
mode:
authormryouse2022-05-13 03:47:35 +0000
committermryouse2022-05-13 03:47:35 +0000
commitbb3bb065d57546370451dd9579cbad2f08758108 (patch)
tree847a5a5bee95817d1d206d9df1b9e5e034e0393f /std.py
parente9459b2104b56618b678404e52a2daeabc1cef61 (diff)
bugfix: Expressions are automatically evaluated (this is a type problem)
Diffstat (limited to 'std.py')
-rw-r--r--std.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/std.py b/std.py
index 1476824..1bb20d4 100644
--- a/std.py
+++ b/std.py
@@ -77,7 +77,7 @@ def std_if(cond, t_branch, f_branch=None):
else:
return t_branch
elif f_branch is not None:
- if isinstance(t_branch, NebExpression):
+ if isinstance(f_branch, NebExpression):
return evaluate_expression(f_branch)
else:
return f_branch
@@ -186,9 +186,21 @@ def build_std():
STD["concat"] = [concat_string_string]
# flow control
+ #if_bool_any_any = FuncImpl(NebFunction("if", [NebBool, NebAny, NebAny], NebAny), std_if)
+ #if_bool_any = FuncImpl(NebFunction("if", [NebBool, NebAny], NebAny), std_if)
+ if_bool_expr_expr = FuncImpl(NebFunction("if", [NebBool, NebExpression, NebExpression], NebAny), std_if)
+ if_bool_expr_any = FuncImpl(NebFunction("if", [NebBool, NebExpression, NebAny], NebAny), std_if)
+ if_bool_any_expr = FuncImpl(NebFunction("if", [NebBool, NebAny, NebExpression], NebAny), std_if)
if_bool_any_any = FuncImpl(NebFunction("if", [NebBool, NebAny, NebAny], NebAny), std_if)
+ if_bool_expr = FuncImpl(NebFunction("if", [NebBool, NebExpression], NebAny), std_if)
if_bool_any = FuncImpl(NebFunction("if", [NebBool, NebAny], NebAny), std_if)
- STD["if"] = [if_bool_any_any, if_bool_any]
+ STD["if"] = [
+ if_bool_expr_expr,
+ if_bool_expr_any,
+ if_bool_any_expr,
+ if_bool_any_any,
+ if_bool_expr,
+ if_bool_any]
# type checking
is_string = FuncImpl(NebFunction("string?", [NebAny], NebBool), std_is_string)