1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-25 09:47:17 +00:00

No errors compiling on BU linux (CentOS).

This commit is contained in:
Calvin Rose 2018-09-10 14:54:12 -04:00
parent a86540a876
commit 0389971049
3 changed files with 12 additions and 11 deletions

View File

@ -239,6 +239,9 @@ static int32_t doarg_1(
int32_t ret = -1; int32_t ret = -1;
JanetTable *c; JanetTable *c;
switch (argtype) { switch (argtype) {
default:
c = NULL;
break;
case JANET_OAT_SLOT: case JANET_OAT_SLOT:
c = &a->slots; c = &a->slots;
break; break;
@ -248,13 +251,6 @@ static int32_t doarg_1(
case JANET_OAT_CONSTANT: case JANET_OAT_CONSTANT:
c = &a->constants; c = &a->constants;
break; break;
case JANET_OAT_INTEGER:
c = NULL;
break;
case JANET_OAT_TYPE:
case JANET_OAT_SIMPLETYPE:
c = NULL;
break;
case JANET_OAT_LABEL: case JANET_OAT_LABEL:
c = &a->labels; c = &a->labels;
break; break;
@ -516,6 +512,7 @@ static JanetAssembleResult janet_asm1(JanetAssembler *parent, Janet source, int
janet_asm_deinit(&a); janet_asm_deinit(&a);
longjmp(a.parent->on_error, 1); longjmp(a.parent->on_error, 1);
} }
result.funcdef = NULL;
result.error = a.errmessage; result.error = a.errmessage;
result.status = JANET_ASSEMBLE_ERROR; result.status = JANET_ASSEMBLE_ERROR;
janet_asm_deinit(&a); janet_asm_deinit(&a);
@ -723,6 +720,7 @@ static JanetAssembleResult janet_asm1(JanetAssembler *parent, Janet source, int
/* Finish everything and return funcdef */ /* Finish everything and return funcdef */
janet_asm_deinit(&a); janet_asm_deinit(&a);
result.error = NULL;
result.funcdef = def; result.funcdef = def;
result.status = JANET_ASSEMBLE_OK; result.status = JANET_ASSEMBLE_OK;
return result; return result;

View File

@ -97,18 +97,18 @@ void janetc_scope(JanetScope *s, JanetCompiler *c, int flags, const char *name)
scope.selfconst = -1; scope.selfconst = -1;
scope.bytecode_start = janet_v_count(c->buffer); scope.bytecode_start = janet_v_count(c->buffer);
scope.flags = flags; scope.flags = flags;
*s = scope; scope.parent = c->scope;
/* Inherit slots */ /* Inherit slots */
if ((!(flags & JANET_SCOPE_FUNCTION)) && c->scope) { if ((!(flags & JANET_SCOPE_FUNCTION)) && c->scope) {
janetc_regalloc_clone(&s->ra, &(c->scope->ra)); janetc_regalloc_clone(&scope.ra, &(c->scope->ra));
} else { } else {
janetc_regalloc_init(&s->ra); janetc_regalloc_init(&scope.ra);
} }
/* Link parent and child and update pointer */ /* Link parent and child and update pointer */
s->parent = c->scope;
if (c->scope) if (c->scope)
c->scope->child = s; c->scope->child = s;
c->scope = s; c->scope = s;
*s = scope;
} }
/* Leave a scope. */ /* Leave a scope. */

View File

@ -20,7 +20,10 @@
* IN THE SOFTWARE. * IN THE SOFTWARE.
*/ */
/* Compiler feature test macros for things */
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#define _BSD_SOURCE
#include <stdio.h> #include <stdio.h>
#include <janet/janet.h> #include <janet/janet.h>
#include <errno.h> #include <errno.h>