mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 21:10:30 +00:00
Support built-in procedures for doc format
This commit is contained in:
@@ -15,7 +15,7 @@ struct OdinDocVersionType {
|
||||
|
||||
#define OdinDocVersionType_Major 0
|
||||
#define OdinDocVersionType_Minor 2
|
||||
#define OdinDocVersionType_Patch 3
|
||||
#define OdinDocVersionType_Patch 4
|
||||
|
||||
struct OdinDocHeaderBase {
|
||||
u8 magic[8];
|
||||
@@ -171,7 +171,8 @@ enum OdinDocEntityFlag : u64 {
|
||||
|
||||
OdinDocEntityFlag_Type_Alias = 1ull<<20,
|
||||
|
||||
OdinDocEntityFlag_Builtin_Procedure = 1ull<<30,
|
||||
OdinDocEntityFlag_Builtin_Pkg_Builtin = 1ull<<30,
|
||||
OdinDocEntityFlag_Builtin_Pkg_Intrinsics = 1ull<<31,
|
||||
|
||||
OdinDocEntityFlag_Var_Thread_Local = 1ull<<40,
|
||||
OdinDocEntityFlag_Var_Static = 1ull<<41,
|
||||
|
||||
@@ -821,6 +821,7 @@ OdinDocEntityIndex odin_doc_add_entity(OdinDocWriter *w, Entity *e) {
|
||||
|
||||
String name = e->token.string;
|
||||
String link_name = {};
|
||||
TokenPos pos = e->token.pos;
|
||||
|
||||
OdinDocEntityKind kind = OdinDocEntity_Invalid;
|
||||
u64 flags = 0;
|
||||
@@ -865,6 +866,24 @@ OdinDocEntityIndex odin_doc_add_entity(OdinDocWriter *w, Entity *e) {
|
||||
if (e->Procedure.is_export) { flags |= OdinDocEntityFlag_Export; }
|
||||
link_name = e->Procedure.link_name;
|
||||
break;
|
||||
case Entity_Builtin:
|
||||
{
|
||||
auto bp = builtin_procs[e->Builtin.id];
|
||||
pos = {};
|
||||
name = bp.name;
|
||||
switch (bp.pkg) {
|
||||
case BuiltinProcPkg_builtin:
|
||||
flags |= OdinDocEntityFlag_Builtin_Pkg_Builtin;
|
||||
break;
|
||||
case BuiltinProcPkg_intrinsics:
|
||||
flags |= OdinDocEntityFlag_Builtin_Pkg_Intrinsics;
|
||||
break;
|
||||
default:
|
||||
GB_PANIC("Unhandled BuiltinProcPkg");
|
||||
}
|
||||
GB_PANIC("HERE");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (e->flags & EntityFlag_Param) {
|
||||
@@ -900,7 +919,7 @@ OdinDocEntityIndex odin_doc_add_entity(OdinDocWriter *w, Entity *e) {
|
||||
|
||||
doc_entity.kind = kind;
|
||||
doc_entity.flags = flags;
|
||||
doc_entity.pos = odin_doc_token_pos_cast(w, e->token.pos);
|
||||
doc_entity.pos = odin_doc_token_pos_cast(w, pos);
|
||||
doc_entity.name = odin_doc_write_string(w, name);
|
||||
doc_entity.type = 0; // Set later
|
||||
doc_entity.init_string = init_string;
|
||||
@@ -1011,7 +1030,7 @@ OdinDocArray<OdinDocScopeEntry> odin_doc_add_pkg_entries(OdinDocWriter *w, AstPa
|
||||
if (e->pkg != pkg) {
|
||||
continue;
|
||||
}
|
||||
if (!is_entity_exported(e)) {
|
||||
if (!is_entity_exported(e, true)) {
|
||||
continue;
|
||||
}
|
||||
if (e->token.string.len == 0) {
|
||||
|
||||
Reference in New Issue
Block a user