mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Fixed O^2 issue relative to method chain length
This commit is contained in:
parent
18f9fb881f
commit
4c40028b33
1 changed files with 34 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
||||||
#include "BfSourceClassifier.h"
|
#include "BfSourceClassifier.h"
|
||||||
#include "BfParser.h"
|
#include "BfParser.h"
|
||||||
|
#include "BeefySysLib/util/BeefPerf.h"
|
||||||
|
|
||||||
USING_NS_BF;
|
USING_NS_BF;
|
||||||
|
|
||||||
|
@ -421,14 +422,22 @@ void BfSourceClassifier::Visit(BfTokenNode* tokenNode)
|
||||||
|
|
||||||
void BfSourceClassifier::Visit(BfInvocationExpression* invocationExpr)
|
void BfSourceClassifier::Visit(BfInvocationExpression* invocationExpr)
|
||||||
{
|
{
|
||||||
BfElementVisitor::Visit(invocationExpr);
|
//BfElementVisitor::Visit(invocationExpr);
|
||||||
|
Visit(invocationExpr->ToBase());
|
||||||
|
|
||||||
|
//BP_ZONE("BfSourceClassifier BfInvocationExpression");
|
||||||
|
|
||||||
BfAstNode* target = invocationExpr->mTarget;
|
BfAstNode* target = invocationExpr->mTarget;
|
||||||
if (target == NULL)
|
if (target == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
VisitChild(invocationExpr->mOpenParen);
|
||||||
|
VisitChild(invocationExpr->mCloseParen);
|
||||||
|
VisitChild(invocationExpr->mGenericArgs);
|
||||||
|
|
||||||
if (auto scopedTarget = BfNodeDynCast<BfScopedInvocationTarget>(target))
|
if (auto scopedTarget = BfNodeDynCast<BfScopedInvocationTarget>(target))
|
||||||
{
|
{
|
||||||
|
VisitChild(target);
|
||||||
target = scopedTarget->mTarget;
|
target = scopedTarget->mTarget;
|
||||||
VisitChild(scopedTarget->mScopeName);
|
VisitChild(scopedTarget->mScopeName);
|
||||||
}
|
}
|
||||||
|
@ -438,10 +447,12 @@ void BfSourceClassifier::Visit(BfInvocationExpression* invocationExpr)
|
||||||
{
|
{
|
||||||
VisitChild(qualifiedName->mLeft);
|
VisitChild(qualifiedName->mLeft);
|
||||||
VisitChild(qualifiedName->mDot);
|
VisitChild(qualifiedName->mDot);
|
||||||
|
VisitChild(qualifiedName->mRight);
|
||||||
identifier = qualifiedName->mRight;
|
identifier = qualifiedName->mRight;
|
||||||
}
|
}
|
||||||
else if ((identifier = BfNodeDynCast<BfIdentifierNode>(target)))
|
else if ((identifier = BfNodeDynCast<BfIdentifierNode>(target)))
|
||||||
{
|
{
|
||||||
|
VisitChild(target);
|
||||||
// Leave as BfAttributedIdentifierNode if that's the case
|
// Leave as BfAttributedIdentifierNode if that's the case
|
||||||
identifier = target;
|
identifier = target;
|
||||||
}
|
}
|
||||||
|
@ -449,14 +460,20 @@ void BfSourceClassifier::Visit(BfInvocationExpression* invocationExpr)
|
||||||
{
|
{
|
||||||
VisitChild(qualifiedName->mLeft);
|
VisitChild(qualifiedName->mLeft);
|
||||||
VisitChild(qualifiedName->mDot);
|
VisitChild(qualifiedName->mDot);
|
||||||
|
VisitChild(qualifiedName->mRight);
|
||||||
identifier = qualifiedName->mRight;
|
identifier = qualifiedName->mRight;
|
||||||
}
|
}
|
||||||
else if (auto memberRefExpr = BfNodeDynCast<BfMemberReferenceExpression>(target))
|
else if (auto memberRefExpr = BfNodeDynCast<BfMemberReferenceExpression>(target))
|
||||||
{
|
{
|
||||||
VisitChild(memberRefExpr->mTarget);
|
VisitChild(memberRefExpr->mTarget);
|
||||||
VisitChild(memberRefExpr->mDotToken);
|
VisitChild(memberRefExpr->mDotToken);
|
||||||
|
VisitChild(memberRefExpr->mMemberName);
|
||||||
identifier = memberRefExpr->mMemberName;
|
identifier = memberRefExpr->mMemberName;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VisitChild(target);
|
||||||
|
}
|
||||||
|
|
||||||
if (identifier != NULL)
|
if (identifier != NULL)
|
||||||
{
|
{
|
||||||
|
@ -469,20 +486,25 @@ void BfSourceClassifier::Visit(BfInvocationExpression* invocationExpr)
|
||||||
if (identifier != NULL)
|
if (identifier != NULL)
|
||||||
SetElementType(identifier, BfSourceElementType_Method);
|
SetElementType(identifier, BfSourceElementType_Method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto& val : invocationExpr->mArguments)
|
||||||
|
VisitChild(val);
|
||||||
|
for (auto& val : invocationExpr->mCommas)
|
||||||
|
VisitChild(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfSourceClassifier::Visit(BfIndexerExpression* indexerExpr)
|
void BfSourceClassifier::Visit(BfIndexerExpression* indexerExpr)
|
||||||
{
|
{
|
||||||
BfElementVisitor::Visit(indexerExpr);
|
//BfElementVisitor::Visit(indexerExpr);
|
||||||
|
Visit(indexerExpr->ToBase());
|
||||||
|
|
||||||
VisitChild(indexerExpr->mTarget);
|
VisitChild(indexerExpr->mTarget);
|
||||||
VisitChild(indexerExpr->mOpenBracket);
|
VisitChild(indexerExpr->mOpenBracket);
|
||||||
for (int i = 0; i < (int) indexerExpr->mArguments.size(); i++)
|
|
||||||
{
|
for (auto& val : indexerExpr->mArguments)
|
||||||
if (i > 0)
|
VisitChild(val);
|
||||||
VisitChild(indexerExpr->mCommas[i - 1]);
|
for (auto& val : indexerExpr->mCommas)
|
||||||
VisitChild(indexerExpr->mArguments[i]);
|
VisitChild(val);
|
||||||
}
|
|
||||||
VisitChild(indexerExpr->mCloseBracket);
|
VisitChild(indexerExpr->mCloseBracket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,6 +545,8 @@ void BfSourceClassifier::Visit(BfMethodDeclaration* methodDeclaration)
|
||||||
if (!IsInterestedInMember(methodDeclaration))
|
if (!IsInterestedInMember(methodDeclaration))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//BP_ZONE("BfSourceClassifier BfMethodDeclaration");
|
||||||
|
|
||||||
SetAndRestoreValue<BfAstNode*> prevMember(mCurMember, methodDeclaration);
|
SetAndRestoreValue<BfAstNode*> prevMember(mCurMember, methodDeclaration);
|
||||||
|
|
||||||
BfElementVisitor::Visit(methodDeclaration);
|
BfElementVisitor::Visit(methodDeclaration);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue