diff options
Diffstat (limited to 'std.py')
| -rw-r--r-- | std.py | 12 | 
1 files changed, 9 insertions, 3 deletions
| @@ -61,9 +61,15 @@ def std_concat(arg1, arg2):  # flow control  def std_if(cond, t_branch, f_branch):      if cond.value: -        ret = evaluate_expression(t_branch) +        if isinstance(t_branch, NebExpression): +            ret = evaluate_expression(t_branch) +        else: +            ret = t_branch      else: -        ret = evaluate_expression(f_branch) +        if isinstance(t_branch, NebExpression): +            ret = evaluate_expression(f_branch) +        else: +            ret = f_branch      return ret  # type validation @@ -153,7 +159,7 @@ def build_std():      STD["concat"] = [concat_string_string]      # flow control -    if_bool_expr_expr = FuncImpl(NebFunction("if", [NebBool, NebExpression, NebExpression], NebAny), std_if) +    if_bool_expr_expr = FuncImpl(NebFunction("if", [NebBool, NebAny, NebAny], NebAny), std_if)      STD["if"] = [if_bool_expr_expr]      # type checking | 
