kate butchered averything :(

This commit is contained in:
Rune
2026-03-06 18:41:15 +01:00
parent 8766c55bbb
commit 6c648ae0cb

View File

@@ -314,7 +314,7 @@ abstract class Cpp2BeefGenerator
wrapperWritter = null;
let args = Args;
#if DEBUG
#if DEBUG
findLang: do
{
for (let arg in args)
@@ -325,7 +325,7 @@ abstract class Cpp2BeefGenerator
}
Runtime.FatalError("You must set a language via Args (e.g. --language=c++)");
}
#endif
#endif
CXTranslationUnit_Flags unitFlags = .SkipFunctionBodies | .DetailedPreprocessingRecord;
unit = Clang.ParseTranslationUnit(index, headerPath, args.Ptr, (.)args.Length, null, 0, (.)unitFlags);
if (unit == default) return .Err(.ParsingFailed);
@@ -1048,25 +1048,25 @@ abstract class Cpp2BeefGenerator
//TODO: move to custom utils
/* // This formats the tokens instead of copying the format 1:1
* const CXTokenKind Unary = (.)-1;
* var prevKind;
* for (let token in tokens)
* {
* let spelling = ScopeCXString!(Clang.GetTokenSpelling(unit, token));
* let kind = Clang.GetTokenKind(token);
* token: switch (kind)
* {
* case .Keyword, .Identifier, .Literal:
* if (prevKind == .Keyword || prevKind == .Identifier || prevKind == .Punctuation)
* str.Append(' ');
* if (kind == .Identifier) do
* {
* var cursor = Clang.GetCursor(unit, Clang.GetTokenLocation(unit, token));
* if (Clang.Cursor_IsNull(cursor) != 0) break;
* cursor = Clang.GetCursorDefinition(cursor);
* if (Clang.Cursor_IsNull(cursor) != 0) break;
* GetNameInBindings(cursor, str);
* break token;
const CXTokenKind Unary = (.)-1;
var prevKind;
for (let token in tokens)
{
let spelling = ScopeCXString!(Clang.GetTokenSpelling(unit, token));
let kind = Clang.GetTokenKind(token);
token: switch (kind)
{
case .Keyword, .Identifier, .Literal:
if (prevKind == .Keyword || prevKind == .Identifier || prevKind == .Punctuation)
str.Append(' ');
if (kind == .Identifier) do
{
var cursor = Clang.GetCursor(unit, Clang.GetTokenLocation(unit, token));
if (Clang.Cursor_IsNull(cursor) != 0) break;
cursor = Clang.GetCursorDefinition(cursor);
if (Clang.Cursor_IsNull(cursor) != 0) break;
GetNameInBindings(cursor, str);
break token;
}
str.Append(spelling);
if (kind == .Literal && str.EndsWith("LL"))
@@ -1407,17 +1407,17 @@ abstract class Cpp2BeefGenerator
BeginBody!(cursor);
//TODO
/*Clang.VisitChildren(cursor, (cursor, parent, client_data) =>
* {
* Self self = (.)Internal.UnsafeCastToObject(client_data);
* switch (cursor.kind)
* {
* case .FieldDecl, .CXXMethod, .Constructor, .Destructor, .ConversionFunction, .FunctionDecl, .VarDecl,
* .FunctionTemplate, .ClassTemplate, .TypeAliasTemplateDecl, .StructDecl, .ClassDecl,
* .UnionDecl, .EnumDecl, .TypeAliasDecl, .TypedefDecl:
* self.WriteComments(cursor);
* return .Break;
* default:
* return .Continue;
{
Self self = (.)Internal.UnsafeCastToObject(client_data);
switch (cursor.kind)
{
case .FieldDecl, .CXXMethod, .Constructor, .Destructor, .ConversionFunction, .FunctionDecl, .VarDecl,
.FunctionTemplate, .ClassTemplate, .TypeAliasTemplateDecl, .StructDecl, .ClassDecl,
.UnionDecl, .EnumDecl, .TypeAliasDecl, .TypedefDecl:
self.WriteComments(cursor);
return .Break;
default:
return .Continue;
}
}, Internal.UnsafeCastToPtr(this));*/
@@ -1445,12 +1445,12 @@ abstract class Cpp2BeefGenerator
str.Append(">\";\n", cursorIndent);
str.Append("private const String __template_chain = CppWrapperF($\"", wrapperTemplateChain, "\");\n\n", cursorIndent);
/*str.Append("[CppWriteToWrapper<\"", WrapperFilePath, "\">(\"\\ntemplate ");
* switch (cursor.kind)
* {
* case .StructDecl: str.Append("struct ");
* case . ClassDecl: str.Append("class " );
* case . UnionDecl: str.Append("union " );
* default: Runtime.FatalError();
switch (cursor.kind)
{
case .StructDecl: str.Append("struct ");
case . ClassDecl: str.Append("class " );
case . UnionDecl: str.Append("union " );
default: Runtime.FatalError();
}
str.Append("\" + __cpp_type + \";\\n\")]\n\n", indent);*/
}