1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-24 17:27:18 +00:00
Fix segfault on macro arity mismatch in compile.c by adding missing return statements.
This commit is contained in:
Calvin Rose 2019-12-31 11:33:03 -05:00
parent bfb638cfc2
commit a15d841b5b
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,7 @@
Unicode True
!echo "Program Files: ${PROGRAMFILES}"
# Version
!define PRODUCT_VERSION "${VERSION}.0"
VIProductVersion "${PRODUCT_VERSION}"

View File

@ -583,18 +583,21 @@ static int macroexpand1(
es = janet_formatc("macro arity mismatch, expected at most %d, got %d", maxar, arity);
c->result.macrofiber = NULL;
janetc_error(c, es);
return 0;
}
/* Set env */
fiberp->env = c->env;
int lock = janet_gclock();
JanetSignal status = janet_continue(fiberp, janet_wrap_nil(), &x);
Janet tempOut;
JanetSignal status = janet_continue(fiberp, janet_wrap_nil(), &tempOut);
janet_gcunlock(lock);
if (status != JANET_SIGNAL_OK) {
const uint8_t *es = janet_formatc("(macro) %V", x);
const uint8_t *es = janet_formatc("(macro) %V", tempOut);
c->result.macrofiber = fiberp;
janetc_error(c, es);
return 0;
} else {
*out = x;
*out = tempOut;
}
return 1;