Skip to content

Commit a11a28d

Browse files
committed
Fix clang assert
1 parent b55c2b3 commit a11a28d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/CppParser/Bootstrap/Bootstrap.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,8 +1401,19 @@ public override bool VisitProperty(Property property)
14011401
WriteLine($"_S->{fieldName} = static_cast<AST::{typeName}>(" +
14021402
$"WalkStatement(S->{methodName}()));");
14031403
else if (typeName.Contains("Expr"))
1404-
WriteLine($"_S->{fieldName} = static_cast<AST::{typeName}>(" +
1405-
$"WalkExpression(S->{methodName}()));");
1404+
{
1405+
var expr = $"_S->{fieldName} = static_cast<AST::{typeName}>(WalkExpression(S->{methodName}()));";
1406+
1407+
if (fieldName == "base")
1408+
{
1409+
WriteLine("if (!S->isImplicitAccess())");
1410+
WriteLineIndent(expr);
1411+
}
1412+
else
1413+
{
1414+
WriteLine(expr);
1415+
}
1416+
}
14061417
else if (fieldName == "guidDecl")
14071418
WriteLine($"_S->{fieldName} = S->getGuidDecl()->getNameAsString();");
14081419
else if (typeName.Contains("Decl") || typeName.Contains("Method") ||

src/CppParser/ParseExpr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2426,7 +2426,8 @@ AST::Expr* Parser::WalkExpression(const clang::Expr* Expr)
24262426
_S->refersToMatrixElement = S->refersToMatrixElement();
24272427
_S->hasPlaceholderType = S->hasPlaceholderType();
24282428
_S->isImplicitAccess = S->isImplicitAccess();
2429-
_S->base = static_cast<AST::Expr*>(WalkExpression(S->getBase()));
2429+
if (!S->isImplicitAccess())
2430+
_S->base = static_cast<AST::Expr*>(WalkExpression(S->getBase()));
24302431
_S->baseType = GetQualifiedType(S->getBaseType());
24312432
_S->isArrow = S->isArrow();
24322433
_S->firstQualifierFoundInScope = static_cast<AST::Declaration*>(WalkDeclaration(S->getFirstQualifierFoundInScope()));

0 commit comments

Comments
 (0)