mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-26 23:11:32 +00:00
fix: record resolved entity for proc-typed default values
This commit is contained in:
@@ -412,7 +412,7 @@ gb_internal bool find_or_generate_polymorphic_procedure(CheckerContext *old_c, E
|
||||
if (!src->Proc.is_polymorphic || src->Proc.is_poly_specialized) {
|
||||
// NOTE: polymorphic procedure check not idempotent without this
|
||||
if (src->Proc.is_poly_specialized && base_entity->Procedure.generated_from_polymorphic) {
|
||||
if (are_types_identical(src, dst)) {
|
||||
if (are_types_identical(src, dst)) {
|
||||
if (poly_proc_data) {
|
||||
poly_proc_data->gen_entity = base_entity;
|
||||
}
|
||||
|
||||
@@ -1791,6 +1791,7 @@ gb_internal ParameterValue handle_parameter_value(CheckerContext *ctx, Type *in_
|
||||
if (e->kind == Entity_Procedure) {
|
||||
param_value.kind = ParameterValue_Constant;
|
||||
param_value.value = exact_value_procedure(e->identifier);
|
||||
param_value.proc_entity = e;
|
||||
add_entity_use(ctx, e->identifier, e);
|
||||
} else {
|
||||
if (e->flags & EntityFlag_Param) {
|
||||
|
||||
@@ -111,6 +111,7 @@ enum ParameterValueKind {
|
||||
struct ParameterValue {
|
||||
ParameterValueKind kind;
|
||||
Ast *original_ast_expr;
|
||||
Entity *proc_entity;
|
||||
union {
|
||||
ExactValue value;
|
||||
Ast *ast_value;
|
||||
|
||||
@@ -4669,6 +4669,12 @@ gb_internal lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValu
|
||||
gb_internal lbValue lb_handle_param_value(lbProcedure *p, Type *parameter_type, ParameterValue const ¶m_value, TypeProc *procedure_type, Ast* call_expression) {
|
||||
switch (param_value.kind) {
|
||||
case ParameterValue_Constant:
|
||||
if (param_value.proc_entity != nullptr && is_type_proc(parameter_type)) {
|
||||
lbValue v = lb_find_procedure_value_from_entity(p->module, param_value.proc_entity);
|
||||
if (v.value != nullptr) {
|
||||
return lb_emit_conv(p, v, parameter_type);
|
||||
}
|
||||
}
|
||||
if (is_type_constant_type(parameter_type)) {
|
||||
auto res = lb_const_value(p->module, parameter_type, param_value.value);
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user