Skip to content

Commit

Permalink
add return type, docs and function kind in json codegen data
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool committed Jan 12, 2025
1 parent 2a1a5e4 commit fa73a1f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion codegen/src/JsonInterfaceGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,18 @@ matjson::Value generateJsonInterface(Root const& root) {
{ "name", name },
}));
}
auto const functionType = [&] {
switch (fn->prototype.type) {
case FunctionType::Normal: return "normal";
case FunctionType::Ctor: return "ctor";
case FunctionType::Dtor: return "dtor";
}
return "unknown";
}();
functions.push_back(matjson::Object({
{ "name", fn->prototype.name },
{ "args", args },
{ "return", fn->prototype.ret.name },
{ "const", fn->prototype.is_const },
{ "virtual", fn->prototype.is_virtual },
{ "static", fn->prototype.is_static },
Expand All @@ -84,7 +93,9 @@ matjson::Value generateJsonInterface(Root const& root) {
{ "ios", bindingOnPlatform(Platform::iOS, fn) },
{ "android32", bindingOnPlatform(Platform::Android32, fn) },
{ "android64", bindingOnPlatform(Platform::Android64, fn) },
}) }
}) },
{ "docs", fn->prototype.attributes.docs },
{ "kind", functionType },
}));
}
}
Expand Down

0 comments on commit fa73a1f

Please sign in to comment.