Browse Source

Remove a few `TODO`s

gingerBill 2 years ago
parent
commit
00823ca88c
5 changed files with 7 additions and 24 deletions
  1. 1 2
      src/build_settings.cpp
  2. 2 5
      src/check_builtin.cpp
  3. 0 8
      src/check_decl.cpp
  4. 2 7
      src/checker.cpp
  5. 2 2
      src/checker.hpp

+ 1 - 2
src/build_settings.cpp

@@ -394,7 +394,7 @@ gb_global TargetMetrics target_darwin_arm64 = {
 	TargetArch_arm64,
 	TargetArch_arm64,
 	8, 8, 16,
 	8, 8, 16,
 	str_lit("arm64-apple-macosx11.0.0"),
 	str_lit("arm64-apple-macosx11.0.0"),
-	str_lit("e-m:o-i64:64-i128:128-n32:64-S128"), // TODO(bill): Is this correct?
+	str_lit("e-m:o-i64:64-i128:128-n32:64-S128"),
 };
 };
 
 
 gb_global TargetMetrics target_freebsd_i386 = {
 gb_global TargetMetrics target_freebsd_i386 = {
@@ -585,7 +585,6 @@ struct LibraryCollections {
 gb_global Array<LibraryCollections> library_collections = {0};
 gb_global Array<LibraryCollections> library_collections = {0};
 
 
 gb_internal void add_library_collection(String name, String path) {
 gb_internal void add_library_collection(String name, String path) {
-	// TODO(bill): Check the path is valid and a directory
 	LibraryCollections lc = {name, string_trim_whitespace(path)};
 	LibraryCollections lc = {name, string_trim_whitespace(path)};
 	array_add(&library_collections, lc);
 	array_add(&library_collections, lc);
 }
 }

+ 2 - 5
src/check_builtin.cpp

@@ -89,7 +89,6 @@ gb_internal void check_or_else_split_types(CheckerContext *c, Operand *x, String
 
 
 
 
 gb_internal void check_or_else_expr_no_value_error(CheckerContext *c, String const &name, Operand const &x, Type *type_hint) {
 gb_internal void check_or_else_expr_no_value_error(CheckerContext *c, String const &name, Operand const &x, Type *type_hint) {
-	// TODO(bill): better error message
 	gbString t = type_to_string(x.type);
 	gbString t = type_to_string(x.type);
 	error(x.expr, "'%.*s' does not return a value, value is of type %s", LIT(name), t);
 	error(x.expr, "'%.*s' does not return a value, value is of type %s", LIT(name), t);
 	if (is_type_union(type_deref(x.type))) {
 	if (is_type_union(type_deref(x.type))) {
@@ -2559,7 +2558,7 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
 		if (is_type_struct(type)) {
 		if (is_type_struct(type)) {
 			isize variable_count = type->Struct.fields.count;
 			isize variable_count = type->Struct.fields.count;
 			slice_init(&tuple->Tuple.variables, a, variable_count);
 			slice_init(&tuple->Tuple.variables, a, variable_count);
-			// TODO(bill): Should I copy each of the entities or is this good enough?
+			// NOTE(bill): don't copy the entities, this should be good enough
 			gb_memmove_array(tuple->Tuple.variables.data, type->Struct.fields.data, variable_count);
 			gb_memmove_array(tuple->Tuple.variables.data, type->Struct.fields.data, variable_count);
 		} else if (is_type_array(type)) {
 		} else if (is_type_array(type)) {
 			isize variable_count = cast(isize)type->Array.count;
 			isize variable_count = cast(isize)type->Array.count;
@@ -3766,9 +3765,7 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
 				mp_err err = mp_pack(rop, max_count, &written, MP_LSB_FIRST, size, endian, nails, &x.value.value_integer);
 				mp_err err = mp_pack(rop, max_count, &written, MP_LSB_FIRST, size, endian, nails, &x.value.value_integer);
 				GB_ASSERT(err == MP_OKAY);
 				GB_ASSERT(err == MP_OKAY);
 
 
-				if (id == BuiltinProc_reverse_bits) {
-					// TODO(bill): Should this even be allowed at compile time?
-				} else {
+				if (id != BuiltinProc_reverse_bits) {
 					u64 v = 0;
 					u64 v = 0;
 					switch (id) {
 					switch (id) {
 					case BuiltinProc_count_ones:
 					case BuiltinProc_count_ones:

+ 0 - 8
src/check_decl.cpp

@@ -10,7 +10,6 @@ gb_internal Type *check_init_variable(CheckerContext *ctx, Entity *e, Operand *o
 			gbString expr_str = expr_to_string(operand->expr);
 			gbString expr_str = expr_to_string(operand->expr);
 
 
 			// TODO(bill): is this a good enough error message?
 			// TODO(bill): is this a good enough error message?
-			// TODO(bill): Actually allow built in procedures to be passed around and thus be created on use
 			error(operand->expr,
 			error(operand->expr,
 				  "Cannot assign built-in procedure '%s' in %.*s",
 				  "Cannot assign built-in procedure '%s' in %.*s",
 				  expr_str,
 				  expr_str,
@@ -122,13 +121,6 @@ gb_internal void check_init_variables(CheckerContext *ctx, Entity **lhs, isize l
 	check_unpack_arguments(ctx, lhs, lhs_count, &operands, inits, true, false);
 	check_unpack_arguments(ctx, lhs, lhs_count, &operands, inits, true, false);
 
 
 	isize rhs_count = operands.count;
 	isize rhs_count = operands.count;
-	for_array(i, operands) {
-		if (operands[i].mode == Addressing_Invalid) {
-			// TODO(bill): Should I ignore invalid parameters?
-			// rhs_count--;
-		}
-	}
-
 	isize max = gb_min(lhs_count, rhs_count);
 	isize max = gb_min(lhs_count, rhs_count);
 	for (isize i = 0; i < max; i++) {
 	for (isize i = 0; i < max; i++) {
 		Entity *e = lhs[i];
 		Entity *e = lhs[i];

+ 2 - 7
src/checker.cpp

@@ -404,7 +404,6 @@ gb_internal void scope_lookup_parent(Scope *scope, String const &name, Scope **s
 			if (found) {
 			if (found) {
 				Entity *e = *found;
 				Entity *e = *found;
 				if (gone_thru_proc) {
 				if (gone_thru_proc) {
-					// IMPORTANT TODO(bill): Is this correct?!
 					if (e->kind == Entity_Label) {
 					if (e->kind == Entity_Label) {
 						continue;
 						continue;
 					}
 					}
@@ -1409,8 +1408,7 @@ gb_internal isize type_info_index(CheckerInfo *info, Type *type, bool error_on_f
 		entry_index = *found_entry_index;
 		entry_index = *found_entry_index;
 	}
 	}
 	if (entry_index < 0) {
 	if (entry_index < 0) {
-		// NOTE(bill): Do manual search
-		// TODO(bill): This is O(n) and can be very slow
+		// NOTE(bill): Do manual linear search
 		for (auto const &e : info->type_info_map) {
 		for (auto const &e : info->type_info_map) {
 			if (are_types_identical_unique_tuples(e.key, type)) {
 			if (are_types_identical_unique_tuples(e.key, type)) {
 				entry_index = e.value;
 				entry_index = e.value;
@@ -2350,7 +2348,7 @@ gb_internal void generate_minimum_dependency_set(Checker *c, Entity *start) {
 
 
 	for_array(i, c->info.definitions) {
 	for_array(i, c->info.definitions) {
 		Entity *e = c->info.definitions[i];
 		Entity *e = c->info.definitions[i];
-		if (e->scope == builtin_pkg->scope) { // TODO(bill): is the check enough?
+		if (e->scope == builtin_pkg->scope) {
 			if (e->type == nullptr) {
 			if (e->type == nullptr) {
 				add_dependency_to_set(c, e);
 				add_dependency_to_set(c, e);
 			}
 			}
@@ -3965,7 +3963,6 @@ gb_internal void check_collect_entities(CheckerContext *c, Slice<Ast *> const &n
 			if (curr_file == nullptr) {
 			if (curr_file == nullptr) {
 				error(decl, "import declarations are only allowed in the file scope");
 				error(decl, "import declarations are only allowed in the file scope");
 				// NOTE(bill): _Should_ be caught by the parser
 				// NOTE(bill): _Should_ be caught by the parser
-				// TODO(bill): Better error handling if it isn't
 				continue;
 				continue;
 			}
 			}
 			// Will be handled later
 			// Will be handled later
@@ -3976,7 +3973,6 @@ gb_internal void check_collect_entities(CheckerContext *c, Slice<Ast *> const &n
 			if ((c->scope->flags&ScopeFlag_File) == 0) {
 			if ((c->scope->flags&ScopeFlag_File) == 0) {
 				error(decl, "%.*s declarations are only allowed in the file scope", LIT(fl->token.string));
 				error(decl, "%.*s declarations are only allowed in the file scope", LIT(fl->token.string));
 				// NOTE(bill): _Should_ be caught by the parser
 				// NOTE(bill): _Should_ be caught by the parser
-				// TODO(bill): Better error handling if it isn't
 				continue;
 				continue;
 			}
 			}
 			check_add_foreign_import_decl(c, decl);
 			check_add_foreign_import_decl(c, decl);
@@ -4167,7 +4163,6 @@ gb_internal void add_import_dependency_node(Checker *c, Ast *decl, PtrMap<AstPac
 		GB_ASSERT(found_node != nullptr);
 		GB_ASSERT(found_node != nullptr);
 		n = *found_node;
 		n = *found_node;
 
 
-		// TODO(bill): How should the edges be attached for 'import'?
 		import_graph_node_set_add(&n->succ, m);
 		import_graph_node_set_add(&n->succ, m);
 		import_graph_node_set_add(&m->pred, n);
 		import_graph_node_set_add(&m->pred, n);
 		ptr_set_add(&m->scope->imported, n->scope);
 		ptr_set_add(&m->scope->imported, n->scope);

+ 2 - 2
src/checker.hpp

@@ -390,7 +390,7 @@ struct CheckerContext {
 
 
 	// Order doesn't matter after this
 	// Order doesn't matter after this
 	u32            state_flags;
 	u32            state_flags;
-	bool           in_defer; // TODO(bill): Actually handle correctly
+	bool           in_defer;
 	Type *         type_hint;
 	Type *         type_hint;
 
 
 	String         proc_name;
 	String         proc_name;
@@ -401,7 +401,7 @@ struct CheckerContext {
 	ForeignContext foreign_context;
 	ForeignContext foreign_context;
 
 
 	CheckerTypePath *type_path;
 	CheckerTypePath *type_path;
-	isize            type_level; // TODO(bill): Actually handle correctly
+	isize            type_level;
 
 
 	UntypedExprInfoMap *untyped;
 	UntypedExprInfoMap *untyped;