mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-22 21:54:59 -07:00
Remove unused packages
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package runtime
|
||||
|
||||
import "core:os"
|
||||
import "core:unicode/utf8"
|
||||
import "core:raw"
|
||||
import "core:mem"
|
||||
|
||||
// Naming Conventions:
|
||||
// In general, Ada_Case for types and snake_case for values
|
||||
//
|
||||
// Package Name: snake_case (but prefer single word)
|
||||
// Import Name: snake_case (but prefer single word)
|
||||
// Types: Ada_Case
|
||||
// Enum Values: Ada_Case
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package strings
|
||||
|
||||
import "core:mem"
|
||||
import "core:raw"
|
||||
|
||||
new_string :: proc(s: string) -> string {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package utf16
|
||||
|
||||
import "core:unicode/utf8"
|
||||
|
||||
REPLACEMENT_CHAR :: '\uFFFD';
|
||||
MAX_RUNE :: '\U0010FFFF';
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ general_stuff :: proc() {
|
||||
x3: b32 = true;
|
||||
x4: b64 = false;
|
||||
|
||||
fmt.printf("x0: %T = %v;\n", x0, x0);
|
||||
fmt.printf("x1: %T = %v;\n", x1, x1);
|
||||
fmt.printf("x2: %T = %v;\n", x2, x2);
|
||||
fmt.printf("x3: %T = %v;\n", x3, x3);
|
||||
|
||||
+30
-14
@@ -445,8 +445,14 @@ void check_scope_usage(Checker *c, Scope *scope) {
|
||||
|
||||
for_array(i, scope->elements.entries) {
|
||||
Entity *e = scope->elements.entries[i].value;
|
||||
if (e != nullptr && e->kind == Entity_Variable && (e->flags&EntityFlag_Used) == 0) {
|
||||
array_add(&unused, e);
|
||||
if (e != nullptr && (e->flags&EntityFlag_Used) == 0) {
|
||||
switch (e->kind) {
|
||||
case Entity_Variable:
|
||||
case Entity_ImportName:
|
||||
case Entity_LibraryName:
|
||||
array_add(&unused, e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -901,23 +907,25 @@ bool add_entity(Checker *c, Scope *scope, AstNode *identifier, Entity *entity) {
|
||||
}
|
||||
|
||||
void add_entity_use(Checker *c, AstNode *identifier, Entity *entity) {
|
||||
GB_ASSERT(identifier != nullptr);
|
||||
if (identifier->kind != AstNode_Ident) {
|
||||
return;
|
||||
}
|
||||
if (entity == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (entity->identifier == nullptr) {
|
||||
entity->identifier = identifier;
|
||||
}
|
||||
identifier->Ident.entity = entity;
|
||||
add_declaration_dependency(c, entity); // TODO(bill): Should this be here?
|
||||
if (identifier != nullptr) {
|
||||
if (identifier->kind != AstNode_Ident) {
|
||||
return;
|
||||
}
|
||||
if (entity->identifier == nullptr) {
|
||||
entity->identifier = identifier;
|
||||
}
|
||||
identifier->Ident.entity = entity;
|
||||
|
||||
String dmsg = entity->deprecated_message;
|
||||
if (dmsg.len > 0) {
|
||||
warning(identifier, "%.*s is deprecated: %.*s", LIT(entity->token.string), LIT(dmsg));
|
||||
String dmsg = entity->deprecated_message;
|
||||
if (dmsg.len > 0) {
|
||||
warning(identifier, "%.*s is deprecated: %.*s", LIT(entity->token.string), LIT(dmsg));
|
||||
}
|
||||
}
|
||||
entity->flags |= EntityFlag_Used;
|
||||
add_declaration_dependency(c, entity); // TODO(bill): Should this be here?
|
||||
}
|
||||
|
||||
|
||||
@@ -2545,6 +2553,9 @@ void check_add_import_decl(Checker *c, AstNodeImportDecl *id) {
|
||||
scope);
|
||||
|
||||
add_entity(c, parent_scope, nullptr, e);
|
||||
if (id->is_using) {
|
||||
add_entity_use(c, nullptr, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2991,6 +3002,11 @@ void check_parsed_files(Checker *c) {
|
||||
check_proc_body(c, pi->token, pi->decl, pi->type, pi->body);
|
||||
}
|
||||
|
||||
for_array(i, c->info.files.entries) {
|
||||
AstFile *f = c->info.files.entries[i].value;
|
||||
check_scope_usage(c, f->scope);
|
||||
}
|
||||
|
||||
TIME_SECTION("generate minimum dependency set");
|
||||
generate_minimum_dependency_set(c, c->info.entry_point);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user