mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-02 03:02:37 +00:00
Remove some dead code
This commit is contained in:
@@ -1745,9 +1745,6 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is
|
||||
if (p->flags&FieldFlag_auto_cast) {
|
||||
param->flags |= EntityFlag_AutoCast;
|
||||
}
|
||||
if (p->flags&FieldFlag_const) {
|
||||
param->flags |= EntityFlag_ConstInput;
|
||||
}
|
||||
|
||||
param->state = EntityState_Resolved; // NOTE(bill): This should have be resolved whilst determining it
|
||||
add_entity(ctx->checker, scope, name, param);
|
||||
|
||||
@@ -4737,6 +4737,14 @@ irValue *ir_emit_comp_against_nil(irProcedure *proc, TokenKind op_kind, irValue
|
||||
irValue *cap = ir_soa_struct_cap(proc, x);
|
||||
return ir_emit_comp(proc, op_kind, cap, v_zero);
|
||||
}
|
||||
} else if (is_type_struct(t) && type_has_nil(t)) {
|
||||
auto args = array_make<irValue *>(heap_allocator(), 2);
|
||||
irValue *lhs = ir_address_from_load_or_generate_local(proc, x);
|
||||
args[0] = ir_emit_conv(proc, lhs, t_rawptr);
|
||||
args[1] = ir_const_int(type_size_of(t));
|
||||
irValue *val = ir_emit_runtime_call(proc, "memory_compare_zero", args);
|
||||
irValue *res = ir_emit_comp(proc, op_kind, val, v_zero);
|
||||
return ir_emit_conv(proc, res, t_bool);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -8584,6 +8584,14 @@ lbValue lb_emit_comp_against_nil(lbProcedure *p, TokenKind op_kind, lbValue x) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
} else if (is_type_struct(t) && type_has_nil(t)) {
|
||||
auto args = array_make<lbValue>(heap_allocator(), 2);
|
||||
lbValue lhs = lb_address_from_load_or_generate_local(p, x);
|
||||
args[0] = lb_emit_conv(p, lhs, t_rawptr);
|
||||
args[1] = lb_const_int(p->module, t_int, type_size_of(t));
|
||||
lbValue val = lb_emit_runtime_call(p, "memory_compare_zero", args);
|
||||
lbValue res = lb_emit_comp(p, op_kind, val, lb_const_int(p->module, t_int, 0));
|
||||
return res;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -3127,7 +3127,6 @@ u32 parse_field_prefixes(AstFile *f) {
|
||||
i32 no_alias_count = 0;
|
||||
i32 c_vararg_count = 0;
|
||||
i32 auto_cast_count = 0;
|
||||
i32 const_count = 0;
|
||||
|
||||
for (;;) {
|
||||
FieldPrefixKind kind = is_token_field_prefix(f);
|
||||
@@ -3145,14 +3144,12 @@ u32 parse_field_prefixes(AstFile *f) {
|
||||
case FieldPrefix_no_alias: no_alias_count += 1; advance_token(f); break;
|
||||
case FieldPrefix_c_var_arg: c_vararg_count += 1; advance_token(f); break;
|
||||
case FieldPrefix_auto_cast: auto_cast_count += 1; advance_token(f); break;
|
||||
case FieldPrefix_const: const_count += 1; advance_token(f); break;
|
||||
}
|
||||
}
|
||||
if (using_count > 1) syntax_error(f->curr_token, "Multiple 'using' in this field list");
|
||||
if (no_alias_count > 1) syntax_error(f->curr_token, "Multiple '#no_alias' in this field list");
|
||||
if (c_vararg_count > 1) syntax_error(f->curr_token, "Multiple '#c_vararg' in this field list");
|
||||
if (auto_cast_count > 1) syntax_error(f->curr_token, "Multiple 'auto_cast' in this field list");
|
||||
if (const_count > 1) syntax_error(f->curr_token, "Multiple '#const' in this field list");
|
||||
|
||||
|
||||
u32 field_flags = 0;
|
||||
@@ -3160,7 +3157,6 @@ u32 parse_field_prefixes(AstFile *f) {
|
||||
if (no_alias_count > 0) field_flags |= FieldFlag_no_alias;
|
||||
if (c_vararg_count > 0) field_flags |= FieldFlag_c_vararg;
|
||||
if (auto_cast_count > 0) field_flags |= FieldFlag_auto_cast;
|
||||
if (const_count > 0) field_flags |= FieldFlag_const;
|
||||
return field_flags;
|
||||
}
|
||||
|
||||
|
||||
@@ -212,13 +212,12 @@ enum FieldFlag {
|
||||
FieldFlag_no_alias = 1<<2,
|
||||
FieldFlag_c_vararg = 1<<3,
|
||||
FieldFlag_auto_cast = 1<<4,
|
||||
FieldFlag_const = 1<<5,
|
||||
|
||||
FieldFlag_Tags = 1<<10,
|
||||
|
||||
FieldFlag_Results = 1<<16,
|
||||
|
||||
FieldFlag_Signature = FieldFlag_ellipsis|FieldFlag_using|FieldFlag_no_alias|FieldFlag_c_vararg|FieldFlag_auto_cast|FieldFlag_const,
|
||||
FieldFlag_Signature = FieldFlag_ellipsis|FieldFlag_using|FieldFlag_no_alias|FieldFlag_c_vararg|FieldFlag_auto_cast,
|
||||
FieldFlag_Struct = FieldFlag_using|FieldFlag_Tags,
|
||||
};
|
||||
|
||||
|
||||
@@ -1788,7 +1788,6 @@ bool is_type_polymorphic(Type *t, bool or_specialized=false) {
|
||||
|
||||
|
||||
bool type_has_undef(Type *t) {
|
||||
// t = base_type(t);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user