mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-01 10:34:41 +00:00
Remove dead code
This commit is contained in:
@@ -26,6 +26,10 @@ string_from_ptr :: proc(ptr: ^byte, len: int) -> string {
|
||||
return transmute(string)mem.Raw_String{ptr, len};
|
||||
}
|
||||
|
||||
compare :: proc(lhs, rhs: string) -> int {
|
||||
return mem.compare(cast([]byte)lhs, cast([]byte)rhs);
|
||||
}
|
||||
|
||||
contains_rune :: proc(s: string, r: rune) -> int {
|
||||
for c, offset in s {
|
||||
if c == r do return offset;
|
||||
@@ -42,6 +46,7 @@ contains_any :: proc(s, chars: string) -> bool {
|
||||
}
|
||||
|
||||
|
||||
|
||||
equal_fold :: proc(s, t: string) -> bool {
|
||||
loop: for s != "" && t != "" {
|
||||
sr, tr: rune;
|
||||
|
||||
@@ -6957,13 +6957,6 @@ gbString write_expr_to_string(gbString str, Ast *node) {
|
||||
}
|
||||
case_end;
|
||||
|
||||
case_ast_node(f, UnionField, node);
|
||||
str = write_expr_to_string(str, f->name);
|
||||
str = gb_string_append_rune(str, '{');
|
||||
str = write_expr_to_string(str, f->list);
|
||||
str = gb_string_append_rune(str, '}');
|
||||
case_end;
|
||||
|
||||
case_ast_node(ce, CallExpr, node);
|
||||
switch (ce->inlining) {
|
||||
case ProcInlining_inline:
|
||||
|
||||
@@ -1283,8 +1283,7 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) {
|
||||
if (fs->post != nullptr) {
|
||||
check_stmt(ctx, fs->post, 0);
|
||||
|
||||
if (fs->post->kind != Ast_AssignStmt &&
|
||||
fs->post->kind != Ast_IncDecStmt) {
|
||||
if (fs->post->kind != Ast_AssignStmt) {
|
||||
error(fs->post, "'for' statement post statement must be a simple statement");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ Token ast_token(Ast *node) {
|
||||
case Ast_ExprStmt: return ast_token(node->ExprStmt.expr);
|
||||
case Ast_TagStmt: return node->TagStmt.token;
|
||||
case Ast_AssignStmt: return node->AssignStmt.op;
|
||||
case Ast_IncDecStmt: return ast_token(node->IncDecStmt.expr);
|
||||
case Ast_BlockStmt: return node->BlockStmt.open;
|
||||
case Ast_IfStmt: return node->IfStmt.token;
|
||||
case Ast_WhenStmt: return node->WhenStmt.token;
|
||||
@@ -74,8 +73,6 @@ Token ast_token(Ast *node) {
|
||||
return ast_token(node->Field.type);
|
||||
case Ast_FieldList:
|
||||
return node->FieldList.token;
|
||||
case Ast_UnionField:
|
||||
return ast_token(node->UnionField.name);
|
||||
|
||||
case Ast_TypeidType: return node->TypeidType.token;
|
||||
case Ast_HelperType: return node->HelperType.token;
|
||||
@@ -219,9 +216,6 @@ Ast *clone_ast(Ast *node) {
|
||||
n->AssignStmt.lhs = clone_ast_array(n->AssignStmt.lhs);
|
||||
n->AssignStmt.rhs = clone_ast_array(n->AssignStmt.rhs);
|
||||
break;
|
||||
case Ast_IncDecStmt:
|
||||
n->IncDecStmt.expr = clone_ast(n->IncDecStmt.expr);
|
||||
break;
|
||||
case Ast_BlockStmt:
|
||||
n->BlockStmt.label = clone_ast(n->BlockStmt.label);
|
||||
n->BlockStmt.stmts = clone_ast_array(n->BlockStmt.stmts);
|
||||
@@ -308,10 +302,6 @@ Ast *clone_ast(Ast *node) {
|
||||
case Ast_FieldList:
|
||||
n->FieldList.list = clone_ast_array(n->FieldList.list);
|
||||
break;
|
||||
case Ast_UnionField:
|
||||
n->UnionField.name = clone_ast(n->UnionField.name);
|
||||
n->UnionField.list = clone_ast(n->UnionField.list);
|
||||
break;
|
||||
|
||||
case Ast_TypeidType:
|
||||
n->TypeidType.specialization = clone_ast(n->TypeidType.specialization);
|
||||
@@ -684,15 +674,6 @@ Ast *ast_assign_stmt(AstFile *f, Token op, Array<Ast *> lhs, Array<Ast *> rhs) {
|
||||
}
|
||||
|
||||
|
||||
Ast *ast_inc_dec_stmt(AstFile *f, Token op, Ast *expr) {
|
||||
Ast *result = alloc_ast_node(f, Ast_IncDecStmt);
|
||||
result->IncDecStmt.op = op;
|
||||
result->IncDecStmt.expr = expr;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Ast *ast_block_stmt(AstFile *f, Array<Ast *> stmts, Token open, Token close) {
|
||||
Ast *result = alloc_ast_node(f, Ast_BlockStmt);
|
||||
result->BlockStmt.stmts = stmts;
|
||||
@@ -826,14 +807,6 @@ Ast *ast_field_list(AstFile *f, Token token, Array<Ast *> list) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Ast *ast_union_field(AstFile *f, Ast *name, Ast *list) {
|
||||
Ast *result = alloc_ast_node(f, Ast_UnionField);
|
||||
result->UnionField.name = name;
|
||||
result->UnionField.list = list;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Ast *ast_typeid_type(AstFile *f, Token token, Ast *specialization) {
|
||||
Ast *result = alloc_ast_node(f, Ast_TypeidType);
|
||||
result->TypeidType.token = token;
|
||||
|
||||
@@ -406,7 +406,6 @@ AST_KIND(_DeclBegin, "", bool) \
|
||||
AST_KIND(_DeclEnd, "", bool) \
|
||||
AST_KIND(Attribute, "attribute", struct { \
|
||||
Token token; \
|
||||
Ast *type; \
|
||||
Array<Ast *> elems; \
|
||||
Token open, close; \
|
||||
}) \
|
||||
@@ -422,10 +421,6 @@ AST_KIND(_DeclEnd, "", bool) \
|
||||
Token token; \
|
||||
Array<Ast *> list; \
|
||||
}) \
|
||||
AST_KIND(UnionField, "union field", struct { \
|
||||
Ast *name; \
|
||||
Ast *list; \
|
||||
}) \
|
||||
AST_KIND(_TypeBegin, "", bool) \
|
||||
AST_KIND(TypeidType, "typeid", struct { \
|
||||
Token token; \
|
||||
|
||||
Reference in New Issue
Block a user