mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 17:34:34 +00:00
Remove dead code in the compiler
This commit is contained in:
@@ -237,9 +237,6 @@ gb_internal Ast *clone_ast(Ast *node) {
|
||||
case Ast_ExprStmt:
|
||||
n->ExprStmt.expr = clone_ast(n->ExprStmt.expr);
|
||||
break;
|
||||
case Ast_TagStmt:
|
||||
n->TagStmt.stmt = clone_ast(n->TagStmt.stmt);
|
||||
break;
|
||||
case Ast_AssignStmt:
|
||||
n->AssignStmt.lhs = clone_ast_array(n->AssignStmt.lhs);
|
||||
n->AssignStmt.rhs = clone_ast_array(n->AssignStmt.rhs);
|
||||
@@ -497,14 +494,6 @@ gb_internal Ast *ast_tag_expr(AstFile *f, Token token, Token name, Ast *expr) {
|
||||
return result;
|
||||
}
|
||||
|
||||
gb_internal Ast *ast_tag_stmt(AstFile *f, Token token, Token name, Ast *stmt) {
|
||||
Ast *result = alloc_ast_node(f, Ast_TagStmt);
|
||||
result->TagStmt.token = token;
|
||||
result->TagStmt.name = name;
|
||||
result->TagStmt.stmt = stmt;
|
||||
return result;
|
||||
}
|
||||
|
||||
gb_internal Ast *ast_unary_expr(AstFile *f, Token op, Ast *expr) {
|
||||
Ast *result = alloc_ast_node(f, Ast_UnaryExpr);
|
||||
result->UnaryExpr.op = op;
|
||||
@@ -1308,16 +1297,6 @@ gb_internal Token advance_token(AstFile *f) {
|
||||
return prev;
|
||||
}
|
||||
|
||||
gb_internal bool peek_token_kind(AstFile *f, TokenKind kind) {
|
||||
for (isize i = f->curr_token_index+1; i < f->tokens.count; i++) {
|
||||
Token tok = f->tokens[i];
|
||||
if (kind != Token_Comment && tok.kind == Token_Comment) {
|
||||
continue;
|
||||
}
|
||||
return tok.kind == kind;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
gb_internal Token peek_token(AstFile *f) {
|
||||
for (isize i = f->curr_token_index+1; i < f->tokens.count; i++) {
|
||||
@@ -1440,17 +1419,6 @@ gb_internal Token expect_operator(AstFile *f) {
|
||||
return prev;
|
||||
}
|
||||
|
||||
gb_internal Token expect_keyword(AstFile *f) {
|
||||
Token prev = f->curr_token;
|
||||
if (!gb_is_between(prev.kind, Token__KeywordBegin+1, Token__KeywordEnd-1)) {
|
||||
String p = token_to_string(prev);
|
||||
syntax_error(f->curr_token, "Expected a keyword, got '%.*s'",
|
||||
LIT(p));
|
||||
}
|
||||
advance_token(f);
|
||||
return prev;
|
||||
}
|
||||
|
||||
gb_internal bool allow_token(AstFile *f, TokenKind kind) {
|
||||
Token prev = f->curr_token;
|
||||
if (prev.kind == kind) {
|
||||
@@ -1957,10 +1925,6 @@ gb_internal bool ast_on_same_line(Token const &x, Ast *yp) {
|
||||
return x.pos.line == y.pos.line;
|
||||
}
|
||||
|
||||
gb_internal bool ast_on_same_line(Ast *x, Ast *y) {
|
||||
return ast_on_same_line(ast_token(x), y);
|
||||
}
|
||||
|
||||
gb_internal Ast *parse_force_inlining_operand(AstFile *f, Token token) {
|
||||
Ast *expr = parse_unary_expr(f, false);
|
||||
Ast *e = strip_or_return_expr(expr);
|
||||
|
||||
Reference in New Issue
Block a user