fix static block appearing before rsquirly
This commit is contained in:
@@ -154,6 +154,9 @@ abstract class Cpp2BeefGenerator
|
||||
case .Namespace: BeginCursor(cursor); Namespace(cursor);
|
||||
case .FunctionDecl: BeginCursor(cursor); FunctionDecl(cursor);
|
||||
|
||||
case .FunctionTemplate, .ClassTemplate, .TypeAliasTemplateDecl:
|
||||
Runtime.FatalError("Templates are currently unsupported but Coming Soon tm");
|
||||
|
||||
case .CXXMethod,
|
||||
.Constructor,
|
||||
.Destructor,
|
||||
@@ -323,7 +326,7 @@ abstract class Cpp2BeefGenerator
|
||||
CXTranslationUnit_Flags unitFlags = .SkipFunctionBodies | .DetailedPreprocessingRecord;
|
||||
unit = Clang.ParseTranslationUnit(index, headerPath, args.Ptr, (.)args.Length, null, 0, (.)unitFlags);
|
||||
if (unit == default) return .Err(.ParsingFailed);
|
||||
|
||||
|
||||
printingPolicy = Clang.GetCursorPrintingPolicy(Clang.GetTranslationUnitCursor(unit));
|
||||
ModifyWrapperPrintingPolicy(printingPolicy);
|
||||
defer Clang.PrintingPolicy_Dispose(printingPolicy);
|
||||
@@ -408,7 +411,6 @@ abstract class Cpp2BeefGenerator
|
||||
switch (cursor.kind)
|
||||
{
|
||||
case .FunctionTemplate, .ClassTemplate, .TypeAliasTemplateDecl:
|
||||
Runtime.FatalError("Templates are currently unsupported but Coming Soon tm");
|
||||
templateParams.Append('<');
|
||||
let len = wrapperTemplateChain.Length;
|
||||
Clang.VisitChildren(cursor, (cursor, parent, client_data) =>
|
||||
@@ -523,7 +525,7 @@ abstract class Cpp2BeefGenerator
|
||||
let cursorLocation = Clang.GetCursorLocation(cursor);
|
||||
//let rangeLocation = Clang.GetRangeStart(Clang.GetCursorExtent(cursor));
|
||||
//if (Clang.File_IsEqual(Clang.GetSpellingLocation(cursorLocation, file: ..?, ?, ?, ?), Clang.GetSpellingLocation(rangeLocation, file: ..?, ?, ?, ?)) == 0)
|
||||
return cursorLocation;
|
||||
return cursorLocation;
|
||||
//return rangeLocation;
|
||||
}
|
||||
|
||||
@@ -542,6 +544,9 @@ abstract class Cpp2BeefGenerator
|
||||
}
|
||||
protected virtual void WriteComments(CXSourceLocation writeUntil, Block? block = null)
|
||||
{
|
||||
var block;
|
||||
if (fileInfo.queuedTokens != .None) block = null;
|
||||
|
||||
Clang.GetFileLocation(writeUntil, let curFile, let curLine, let curColumn, let curOffset);
|
||||
Clang.GetFileLocation(fileInfo.prevEnd, let prevFile, let prevLine, let prevColumn, let prevOffset);
|
||||
|
||||
@@ -587,6 +592,7 @@ abstract class Cpp2BeefGenerator
|
||||
|
||||
void Block()
|
||||
{
|
||||
if (fileInfo.queuedTokens != .None) return;
|
||||
findMacros: do
|
||||
{
|
||||
for (uint32 ln = line; ln < curLine; ln++)
|
||||
@@ -620,6 +626,7 @@ abstract class Cpp2BeefGenerator
|
||||
QueuedToken!(decltype(fileInfo.queuedTokens).RSquirly, "}");
|
||||
|
||||
if (!isWritingQueuedToken) continue;
|
||||
if (fileInfo.queuedTokens == .None) block = @block;
|
||||
default: continue;
|
||||
}
|
||||
let location = Clang.GetTokenLocation(unit, token);
|
||||
@@ -637,7 +644,7 @@ abstract class Cpp2BeefGenerator
|
||||
Flush();
|
||||
}
|
||||
WriteLinesUntil!(curLine, writeUntil);
|
||||
if (block.HasValue) WriteBlock(block.Value);
|
||||
if (@block.HasValue) WriteBlock(@block.Value);
|
||||
}
|
||||
|
||||
protected enum TypeParamMode { None, InParam, OutParam }
|
||||
@@ -940,7 +947,7 @@ abstract class Cpp2BeefGenerator
|
||||
String whitespace;
|
||||
if (preserveColumns)
|
||||
{
|
||||
whitespace = scope .(str);
|
||||
whitespace = scope:: .(str);
|
||||
str.Clear();
|
||||
Type(type);
|
||||
whitespace.Length -= Math.Min(str.Length, whitespace.Length);
|
||||
@@ -1057,7 +1064,7 @@ abstract class Cpp2BeefGenerator
|
||||
if (Clang.Cursor_IsNull(cursor) != 0) break;
|
||||
GetNameInBindings(cursor, str);
|
||||
break token;
|
||||
}
|
||||
}
|
||||
str.Append(spelling);
|
||||
if (kind == .Literal && str.EndsWith("LL"))
|
||||
str.Length--;
|
||||
@@ -1501,7 +1508,7 @@ abstract class Cpp2BeefGenerator
|
||||
str.Append(" : ");
|
||||
Type(Clang.GetEnumDeclIntegerType(cursor));
|
||||
str.Append(templateParamsWhere);
|
||||
}
|
||||
}
|
||||
BeginBody!(cursor);
|
||||
Clang.VisitChildren(cursor, (cursor, parent, client_data) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user