From: Brendan Hansen Date: Fri, 26 Jun 2020 18:18:15 +0000 (-0500) Subject: fixed accidental pasting X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=796aee77b7a053a33e74b8c54e4b1f481939fbc0;p=onyx.git fixed accidental pasting Always compile before commiting! --- diff --git a/Makefile b/Makefile index a81309b8..259e4281 100644 --- a/Makefile +++ b/Makefile @@ -16,15 +16,15 @@ FLAGS=-g TARGET=./onyx build/%.o: src/%.c include/bh.h - $(CC) $(FLAGS) -c $< -o $@ $(INCLUDES) + $(CC) $(FLAGS) -c $< -o $@ $(INCLUDES) $(TARGET): $(OBJ_FILES) - $(CC) $(FLAGS) $(OBJ_FILES) -o $@ $(LIBS) + $(CC) $(FLAGS) $(OBJ_FILES) -o $@ $(LIBS) install: $(TARGET) - cp $(TARGET) /usr/bin/ + cp $(TARGET) /usr/bin/ clean: - rm -f $(OBJ_FILES) 2>&1 >/dev/null + rm -f $(OBJ_FILES) 2>&1 >/dev/null all: onyx diff --git a/include/onyxparser.h b/include/onyxparser.h index 97bae85f..94e934bc 100644 --- a/include/onyxparser.h +++ b/include/onyxparser.h @@ -1,5 +1,4 @@ #ifndef ONYXPARSER_H - negate_node->operation = ONYX_UNARY_OP_NEGATE; #define ONYXPARSER_H #include "bh.h" diff --git a/onyx b/onyx index 0245333a..9ce36fd1 100755 Binary files a/onyx and b/onyx differ diff --git a/src/onyxsymres.c b/src/onyxsymres.c index d5cf6d6e..130b61cb 100644 --- a/src/onyxsymres.c +++ b/src/onyxsymres.c @@ -75,20 +75,20 @@ static OnyxAstNode* symbol_resolve(OnyxSemPassState* state, OnyxAstNode* symbol) } static void scope_enter(OnyxSemPassState* state, OnyxAstNodeScope* scope) { - scope->prev_scope = state->curr_scope; - state->curr_scope = scope; + scope->prev_scope = state->curr_scope; + state->curr_scope = scope; } static OnyxAstNodeScope* scope_leave(OnyxSemPassState* state) { - // NOTE: Can't leave a scope if there is no scope - assert(state->curr_scope != NULL); + // NOTE: Can't leave a scope if there is no scope + assert(state->curr_scope != NULL); - for (OnyxAstNodeLocal *walker = state->curr_scope->last_local; walker != NULL; walker = walker->prev_local) { - symbol_remove(state, (OnyxAstNode *) walker); - } + for (OnyxAstNodeLocal *walker = state->curr_scope->last_local; walker != NULL; walker = walker->prev_local) { + symbol_remove(state, (OnyxAstNode *) walker); + } - state->curr_scope = state->curr_scope->prev_scope; - return state->curr_scope; + state->curr_scope = state->curr_scope->prev_scope; + return state->curr_scope; } static b32 define_function(OnyxSemPassState* state, OnyxAstNodeFuncDef* func) { @@ -205,7 +205,7 @@ static b32 symres_statement(OnyxSemPassState* state, OnyxAstNode* stmt) { switch (stmt->kind) { case ONYX_AST_NODE_KIND_LOCAL: symres_local(state, (OnyxAstNodeLocal **) &stmt); return 1; case ONYX_AST_NODE_KIND_ASSIGNMENT: symres_assignment(state, stmt); return 0; - case ONYX_AST_NODE_KIND_RETURN: symres_return(state, stmt); return 0; + case ONYX_AST_NODE_KIND_RETURN: symres_return(state, stmt); return 0; case ONYX_AST_NODE_KIND_IF: symres_if(state, &stmt->as_if); return 0; case ONYX_AST_NODE_KIND_WHILE: symres_while(state, &stmt->as_while); return 0; case ONYX_AST_NODE_KIND_CALL: symres_call(state, stmt); return 0; diff --git a/src/onyxutils.c b/src/onyxutils.c index 404e1d79..f5f90a92 100644 --- a/src/onyxutils.c +++ b/src/onyxutils.c @@ -118,15 +118,6 @@ void onyx_ast_print(OnyxAstNode* node, i32 indent) { break; } - case ONYX_AST_NODE_KIND_CAST: { - bh_printf("to %s ", node->type->name); - onyx_ast_print(node->left, indent + 1); - if (node->next) { - onyx_ast_print(node->next, indent); - } - break; - } - case ONYX_AST_NODE_KIND_CALL: { OnyxAstNodeCall* call = &node->as_call; if (call->callee) {