@@ -154,7 +154,7 @@ private void GenerateExpr(BindingContext ctx)
154
154
var specifiersUnit = ctx . ASTContext . TranslationUnits . Find ( unit =>
155
155
unit . FileName == "Specifiers.h" ) ;
156
156
var nonOdrUseReason = specifiersUnit . FindEnum ( "clang::NonOdrUseReason" ) ;
157
-
157
+
158
158
var apFloatUnit = ctx . ASTContext . TranslationUnits . Find ( unit =>
159
159
unit . FileName == "APFloat.h" ) ;
160
160
var floatSemantics = apFloatUnit
@@ -165,7 +165,7 @@ private void GenerateExpr(BindingContext ctx)
165
165
// Move to outer namespace
166
166
floatSemantics . Namespace = floatSemantics . Namespace . Namespace . Namespace ;
167
167
168
- var decls = new Declaration [ ] {
168
+ var decls = new Declaration [ ] {
169
169
operationKindsUnit , operatorKindsUnit ,
170
170
unaryExprOrTypeTrait , nonOdrUseReason ,
171
171
exprDependence , floatSemantics
@@ -340,7 +340,7 @@ private static void Check(Declaration decl)
340
340
341
341
if ( decl . Name == "EmptyShell" )
342
342
decl . ExplicitlyIgnore ( ) ;
343
-
343
+
344
344
if ( decl . Name == "DecomposedForm" )
345
345
decl . ExplicitlyIgnore ( ) ;
346
346
@@ -613,8 +613,7 @@ public override bool VisitClassDecl(Class @class)
613
613
var iteratorTypeName = GetIteratorTypeName ( iteratorType , TypePrinter ) ;
614
614
var declName = GetDeclName ( method , GeneratorKind . CSharp ) ;
615
615
616
- WriteLine ( $@ "public List<{ iteratorTypeName } > {
617
- declName } {{ get; private set; }} = new List<{ iteratorTypeName } >();" ) ;
616
+ WriteLine ( $@ "public List<{ iteratorTypeName } > { declName } {{ get; private set; }} = new List<{ iteratorTypeName } >();") ;
618
617
}
619
618
620
619
foreach ( var property in @class . Properties )
@@ -1192,7 +1191,7 @@ private string GenerateInit(Property property)
1192
1191
{
1193
1192
if ( property . Type . IsPointer ( ) )
1194
1193
return "nullptr" ;
1195
-
1194
+
1196
1195
if ( property . Type . IsPrimitiveType ( PrimitiveType . Bool ) )
1197
1196
return "false" ;
1198
1197
@@ -1202,7 +1201,7 @@ private string GenerateInit(Property property)
1202
1201
1203
1202
if ( property . Type . TryGetEnum ( out Enumeration @enum ) )
1204
1203
return $ "{ GetQualifiedName ( @enum ) } ::{ @enum . Items . First ( ) . Name } ";
1205
-
1204
+
1206
1205
return "0" ;
1207
1206
}
1208
1207
@@ -1233,7 +1232,7 @@ public void GenerateParser()
1233
1232
WriteInclude ( "Parser.h" , CInclude . IncludeKind . Quoted ) ;
1234
1233
GenerateIncludes ( ) ;
1235
1234
NewLine ( ) ;
1236
-
1235
+
1237
1236
WriteLine ( "namespace CppSharp::CppParser {" ) ;
1238
1237
NewLine ( ) ;
1239
1238
@@ -1259,7 +1258,7 @@ private void GenerateWalkStatement()
1259
1258
WriteLine ( MethodSig ) ;
1260
1259
WriteOpenBraceAndIndent ( ) ;
1261
1260
1262
- WriteLine ( $ "if (!{ BaseTypeName } )") ;
1261
+ WriteLine ( $ "if (!{ BaseTypeName } )") ;
1263
1262
WriteLineIndent ( "return nullptr;" ) ;
1264
1263
NewLine ( ) ;
1265
1264
@@ -1401,8 +1400,19 @@ public override bool VisitProperty(Property property)
1401
1400
WriteLine ( $ "_S->{ fieldName } = static_cast<AST::{ typeName } >(" +
1402
1401
$ "WalkStatement(S->{ methodName } ()));") ;
1403
1402
else if ( typeName . Contains ( "Expr" ) )
1404
- WriteLine ( $ "_S->{ fieldName } = static_cast<AST::{ typeName } >(" +
1405
- $ "WalkExpression(S->{ methodName } ()));") ;
1403
+ {
1404
+ var expr = $ "_S->{ fieldName } = static_cast<AST::{ typeName } >(WalkExpression(S->{ methodName } ()));";
1405
+
1406
+ if ( fieldName == "base" )
1407
+ {
1408
+ WriteLine ( "if (!S->isImplicitAccess())" ) ;
1409
+ WriteLineIndent ( expr ) ;
1410
+ }
1411
+ else
1412
+ {
1413
+ WriteLine ( expr ) ;
1414
+ }
1415
+ }
1406
1416
else if ( fieldName == "guidDecl" )
1407
1417
WriteLine ( $ "_S->{ fieldName } = S->getGuidDecl()->getNameAsString();") ;
1408
1418
else if ( typeName . Contains ( "Decl" ) || typeName . Contains ( "Method" ) ||
@@ -1565,18 +1575,18 @@ static class CodeGeneratorHelpers
1565
1575
public static bool IsAbstractStmt ( Class @class ) => IsAbstractStmt ( @class . Name ) ;
1566
1576
1567
1577
public static bool IsAbstractStmt ( string className ) =>
1568
- className is "Stmt"
1569
- or "ValueStmt"
1570
- or "NoStmt"
1571
- or "SwitchCase"
1572
- or "AsmStmt"
1573
- or "Expr"
1574
- or "FullExpr"
1575
- or "CastExpr"
1576
- or "ExplicitCastExpr"
1577
- or "AbstractConditionalOperator"
1578
- or "CXXNamedCastExpr"
1579
- or "OverloadExpr"
1578
+ className is "Stmt"
1579
+ or "ValueStmt"
1580
+ or "NoStmt"
1581
+ or "SwitchCase"
1582
+ or "AsmStmt"
1583
+ or "Expr"
1584
+ or "FullExpr"
1585
+ or "CastExpr"
1586
+ or "ExplicitCastExpr"
1587
+ or "AbstractConditionalOperator"
1588
+ or "CXXNamedCastExpr"
1589
+ or "OverloadExpr"
1580
1590
or "CoroutineSuspendExpr" ;
1581
1591
1582
1592
public static bool SkipProperty ( Property property , bool skipBaseCheck = false )
@@ -1748,7 +1758,7 @@ public static bool SkipProperty(Property property, bool skipBaseCheck = false)
1748
1758
// UnresolvedMemberExpr
1749
1759
if ( typeName . Contains ( "DeclarationName" ) )
1750
1760
return true ;
1751
-
1761
+
1752
1762
// SubstNonTypeTemplateParmExpr
1753
1763
// SubstNonTypeTemplateParmPackExpr
1754
1764
if ( typeName . Contains ( "NonTypeTemplateParmDecl" ) )
@@ -1780,7 +1790,7 @@ public static bool SkipProperty(Property property, bool skipBaseCheck = false)
1780
1790
// CXXRewrittenBinaryOperator
1781
1791
if ( typeName . Contains ( "DecomposedForm" ) )
1782
1792
return true ;
1783
-
1793
+
1784
1794
if ( typeName . Contains ( "optional" ) )
1785
1795
return true ;
1786
1796
@@ -1939,9 +1949,9 @@ public static string GetDeclTypeName(AST.Type type,
1939
1949
var typeResult = declType . Visit ( typePrinter ) ;
1940
1950
1941
1951
if ( typeResult . Type . Contains ( "MSGuidDecl" ) )
1942
- return typePrinter is CppTypePrinter
1952
+ return typePrinter is CppTypePrinter
1943
1953
? "std::string" : "string" ;
1944
-
1954
+
1945
1955
var typeName = typeResult . ToString ( ) ;
1946
1956
typeName = CleanClangNamespaceFromName ( typeName ) ;
1947
1957
@@ -1951,7 +1961,7 @@ public static string GetDeclTypeName(AST.Type type,
1951
1961
typeName = "UnaryOperatorKind" ;
1952
1962
else if ( typeName . Contains ( "BinaryOperator::Opcode" ) )
1953
1963
typeName = "BinaryOperatorKind" ;
1954
-
1964
+
1955
1965
else if ( typeName . Contains ( "Semantics" ) )
1956
1966
typeName = "FloatSemantics" ;
1957
1967
@@ -2037,15 +2047,15 @@ public static string GetIteratorTypeName(AST.Type iteratorType,
2037
2047
2038
2048
if ( iteratorTypeName . Contains ( "ExprIterator" ) )
2039
2049
iteratorTypeName = "Expr" ;
2040
-
2050
+
2041
2051
else if ( iteratorTypeName . Contains ( "StmtIterator" ) )
2042
2052
iteratorTypeName = "Stmt" ;
2043
2053
2044
2054
else if ( iteratorTypeName . Contains ( "CastIterator" ) )
2045
2055
{
2046
2056
if ( iteratorType is TypedefType typedefType )
2047
2057
iteratorType = typedefType . Declaration . Type ;
2048
-
2058
+
2049
2059
var templateArg = ( ( TemplateSpecializationType ) iteratorType ) . Arguments [ 0 ] ;
2050
2060
iteratorType = templateArg . Type . Type ;
2051
2061
0 commit comments