Skip to content

Commit

Permalink
Preparing for Adept 2.4 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacShelton committed Jan 9, 2021
1 parent accb84f commit 9563019
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
10 changes: 4 additions & 6 deletions src/INFER/infer.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ errorcode_t infer_in_funcs(infer_ctx_t *ctx, ast_func_t *funcs, length_t funcs_l
const bool force_used = ctx->compiler->ignore & COMPILER_IGNORE_UNUSED
? true
: function->traits & AST_FUNC_MAIN || (a == 0 && strcmp(function->arg_names[a], "this") == 0);

if(strcmp(function->arg_names[a], "this") == 0 && a != 0)
printf("%zu\n", a);

infer_var_scope_add_variable(&func_scope, function->arg_names[a], &function->arg_types[a], function->arg_sources[a], force_used, false);
}
Expand Down Expand Up @@ -1292,10 +1289,9 @@ void infer_var_list_nearest(infer_var_list_t *list, const char *name, char **out
*out_nearest_name = NULL;
if(out_distance) *out_distance = -1;

// Stack array to contain all of the distances
// NOTE: This may be bad if the length of the variable list is really long
// Heap-allocated array to contain all of the distances
length_t list_length = list->length;
int distances[list_length];
int *distances = malloc(sizeof(int) * list_length);

// Calculate distance for every variable name
for(length_t i = 0; i != list_length; i++){
Expand All @@ -1315,6 +1311,8 @@ void infer_var_list_nearest(infer_var_list_t *list, const char *name, char **out

// Output minimum distance if a name close enough was found
if(out_distance && *out_nearest_name) *out_distance = minimum;

free(distances);
}

void infer_mention_expression_literal_type(infer_ctx_t *ctx, unsigned int expression_literal_id){
Expand Down
8 changes: 2 additions & 6 deletions src/IR/ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@

strong_cstr_t ir_value_str(ir_value_t *value){
if(value == NULL){
terminal_set_color(TERMINAL_COLOR_RED);
printf("INTERNAL ERROR: The value passed to ir_value_str is NULL, a crash will probably follow...\n");
terminal_set_color(TERMINAL_COLOR_DEFAULT);
internalerrorprintf("The value passed to ir_value_str is NULL, a crash will probably follow...\n");
}

if(value->type == NULL){
terminal_set_color(TERMINAL_COLOR_RED);
printf("INTERNAL ERROR: The value passed to ir_value_str has a type pointer to NULL, a crash will probably follow...\n");
terminal_set_color(TERMINAL_COLOR_DEFAULT);
internalerrorprintf("The value passed to ir_value_str has a type pointer to NULL, a crash will probably follow...\n");
}

char *typename = ir_type_str(value->type);
Expand Down
3 changes: 3 additions & 0 deletions src/UTIL/filename.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ void filename_auto_ext(strong_cstr_t *out_filename, unsigned int cross_compile_f

if(mode == FILENAME_AUTO_EXECUTABLE){
#if defined(__WIN32__)
// Ignore unused variable 'cross_compile_for'
(void) cross_compile_for;

// Windows file extensions
filename_append_if_missing(out_filename, ".exe");
return;
Expand Down
4 changes: 2 additions & 2 deletions src/UTIL/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ void memory_free(void* data){
}

#ifdef TRACK_MEMORY_FILE_AND_LINE
printf("INTERNAL ERROR: Tried to free memory that isn't in the global memblocks table! (Address: %p) - %s %d\n", data, file, line);
internalerrorprintf("Tried to free memory that isn't in the global memblocks table! (Address: %p) - %s %d\n", data, file, line);
#else // TRACK_MEMORY_FILE_AND_LINE
printf("INTERNAL ERROR: Tried to free memory that isn't in the global memblocks table! (Address: %p)\n", data);
internalerrorprintf("Tried to free memory that isn't in the global memblocks table! (Address: %p)\n", data);
#endif
return;
}
Expand Down

0 comments on commit 9563019

Please sign in to comment.