added a test case to check a block expression as a conditional expression for if
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
8345e2f949
commit
00ad4dd779
@ -4497,7 +4497,6 @@ redo:
|
|||||||
if (compile_cons_mlist_expression(hcl, oprnd, 0) <= -1) return -1;
|
if (compile_cons_mlist_expression(hcl, oprnd, 0) <= -1) return -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case HCL_CONCODE_BLOCK:
|
case HCL_CONCODE_BLOCK:
|
||||||
if (!(hcl->option.trait & HCL_TRAIT_LANG_ENABLE_BLOCK))
|
if (!(hcl->option.trait & HCL_TRAIT_LANG_ENABLE_BLOCK))
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,9 @@ if (eqv? J 1296) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
k := 5
|
||||||
|
if { q := 10; k < q } { ## a block expression is a normal expression. so t can be used as a conditional expression for if
|
||||||
|
printf "OK: k is less than q\n"
|
||||||
|
} else (printf "BAD: k is not less than q\n")
|
||||||
|
|
||||||
} ## END
|
} ## END
|
||||||
|
@ -20,7 +20,7 @@ defun mkfun(t) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
defun mkfund(t) {
|
defun mkfun2(t) {
|
||||||
return {fun(c) {
|
return {fun(c) {
|
||||||
return (fun(d) {
|
return (fun(d) {
|
||||||
return (+ d c t)
|
return (+ d c t)
|
||||||
@ -55,7 +55,7 @@ if (k = 60) {
|
|||||||
printf "ERROR - %d\n" k
|
printf "ERROR - %d\n" k
|
||||||
};
|
};
|
||||||
|
|
||||||
k := (((mkfund 10) 40) 30)
|
k := (((mkfun2 10) 40) 30)
|
||||||
if (k = 80) {
|
if (k = 80) {
|
||||||
printf "OK - %d\n" k
|
printf "OK - %d\n" k
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user