mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 19:19:53 +00:00
Fix an offset bug in closure creation.
This commit is contained in:
parent
8d302d9b1f
commit
da15dac16b
@ -180,14 +180,19 @@ static int32_t string_description_impl(uint8_t *buf, const char *title, void *po
|
|||||||
*c++ = ' ';
|
*c++ = ' ';
|
||||||
*c++ = '0';
|
*c++ = '0';
|
||||||
*c++ = 'x';
|
*c++ = 'x';
|
||||||
for (i = sizeof(void *); i > 0; --i) {
|
#if defined(DST_64)
|
||||||
|
#define POINTSIZE 6
|
||||||
|
#else
|
||||||
|
#define POINTSIZE (sizeof(void *))
|
||||||
|
#endif
|
||||||
|
for (i = POINTSIZE; i > 0; --i) {
|
||||||
uint8_t byte = pbuf.bytes[i - 1];
|
uint8_t byte = pbuf.bytes[i - 1];
|
||||||
if (!byte) continue;
|
|
||||||
*c++ = HEX(byte >> 4);
|
*c++ = HEX(byte >> 4);
|
||||||
*c++ = HEX(byte & 0xF);
|
*c++ = HEX(byte & 0xF);
|
||||||
}
|
}
|
||||||
*c++ = '>';
|
*c++ = '>';
|
||||||
return (int32_t) (c - buf);
|
return (int32_t) (c - buf);
|
||||||
|
#undef POINTSIZE
|
||||||
}
|
}
|
||||||
|
|
||||||
static void string_description_b(DstBuffer *buffer, const char *title, void *pointer) {
|
static void string_description_b(DstBuffer *buffer, const char *title, void *pointer) {
|
||||||
|
@ -493,7 +493,7 @@ static void *op_lookup[255] = {
|
|||||||
for (i = 0; i < elen; ++i) {
|
for (i = 0; i < elen; ++i) {
|
||||||
int32_t inherit = fd->environments[i];
|
int32_t inherit = fd->environments[i];
|
||||||
if (inherit == -1) {
|
if (inherit == -1) {
|
||||||
DstStackFrame *frame = (DstStackFrame *)stack - 1;
|
DstStackFrame *frame = dst_stack_frame(stack);
|
||||||
if (!frame->env) {
|
if (!frame->env) {
|
||||||
/* Lazy capture of current stack frame */
|
/* Lazy capture of current stack frame */
|
||||||
DstFuncEnv *env = dst_gcalloc(DST_MEMORY_FUNCENV, sizeof(DstFuncEnv));
|
DstFuncEnv *env = dst_gcalloc(DST_MEMORY_FUNCENV, sizeof(DstFuncEnv));
|
||||||
|
@ -50,10 +50,7 @@ extern "C" {
|
|||||||
|| defined(sun) || defined(__sun) /* Solaris */ \
|
|| defined(sun) || defined(__sun) /* Solaris */ \
|
||||||
|| defined(unix) || defined(__unix) || defined(__unix__)
|
|| defined(unix) || defined(__unix) || defined(__unix__)
|
||||||
#define DST_UNIX 1
|
#define DST_UNIX 1
|
||||||
#endif
|
#elif defined(__EMSCRIPTEN__)
|
||||||
|
|
||||||
/* Check Windows */
|
|
||||||
#ifdef __EMSCRIPTEN__
|
|
||||||
#define DST_WEB 1
|
#define DST_WEB 1
|
||||||
#elif defined(WIN32) || defined(_WIN32)
|
#elif defined(WIN32) || defined(_WIN32)
|
||||||
#define DST_WINDOWS 1
|
#define DST_WINDOWS 1
|
||||||
|
Loading…
Reference in New Issue
Block a user