diff options
| author | gingerBill <bill@gingerbill.org> | 2021-12-03 11:46:54 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-12-03 11:46:54 +0000 |
| commit | 6ce5608003e630bc0de1c591fd4cbea3fe59e1d3 (patch) | |
| tree | 2ab596dd5ce9721d9844f26467a23b593a6ea43a /src/docs_writer.cpp | |
| parent | db42a2db47550181998a348b9a2ec7ca1979c702 (diff) | |
Correct `odin doc` default parameter value `init_string` generation
Diffstat (limited to 'src/docs_writer.cpp')
| -rw-r--r-- | src/docs_writer.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/docs_writer.cpp b/src/docs_writer.cpp index 430e26782..e8e8892ec 100644 --- a/src/docs_writer.cpp +++ b/src/docs_writer.cpp @@ -826,6 +826,9 @@ OdinDocEntityIndex odin_doc_add_entity(OdinDocWriter *w, Entity *e) { } if (e->flags & EntityFlag_Static) { flags |= OdinDocEntityFlag_Var_Static; } link_name = e->Variable.link_name; + if (init_expr == nullptr) { + init_expr = e->Variable.init_expr; + } break; case Entity_Procedure: if (e->Procedure.is_foreign) { flags |= OdinDocEntityFlag_Foreign; } @@ -856,8 +859,8 @@ OdinDocEntityIndex odin_doc_add_entity(OdinDocWriter *w, Entity *e) { init_string = odin_doc_write_string(w, make_string_c(exact_value_to_string(e->Constant.value))); } } else if (e->kind == Entity_Variable) { - if (e->Variable.param_expr) { - init_string = odin_doc_expr_string(w, e->Variable.param_expr); + if (e->Variable.param_value.original_ast_expr) { + init_string = odin_doc_expr_string(w, e->Variable.param_value.original_ast_expr); } } } |