fixed accidental pasting
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 26 Jun 2020 18:18:15 +0000 (13:18 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 26 Jun 2020 18:18:15 +0000 (13:18 -0500)
Always compile before commiting!

Makefile
include/onyxparser.h
onyx
src/onyxsymres.c
src/onyxutils.c

index a81309b88143215bde2bd8ca864a049ea783a292..259e42818c0346c5cba4245b85580611de1a1c9f 100644 (file)
--- 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
index 97bae85f2f1f4a18e87c2b351668e1e564cc0e6b..94e934bcfda186968cffdf506cecba769a112590 100644 (file)
@@ -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 0245333ad254d02ae277adfb705874793fe6f10c..9ce36fd1abca2cc2cf9e0f4ffedaf81a7e5a9ce4 100755 (executable)
Binary files a/onyx and b/onyx differ
index d5cf6d6ea7ea9c6b050f3d24580502a5dccee897..130b61cbae3ff1ad2eac81c74eb5383b34fd701f 100644 (file)
@@ -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;
index 404e1d798cd3825318e702f830ff58a71ebfa22b..f5f90a92bec61d4abcf5a9d757f48c78b58a64e3 100644 (file)
@@ -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) {