mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Added constraints for operators, 'external' constraints for methods
This commit is contained in:
parent
00a92dd0a7
commit
8945a906f7
24 changed files with 1561 additions and 509 deletions
|
@ -468,11 +468,8 @@ void BfSourceClassifier::Visit(BfMethodDeclaration* methodDeclaration)
|
|||
SetAndRestoreValue<BfAstNode*> prevMember(mCurMember, methodDeclaration);
|
||||
|
||||
BfElementVisitor::Visit(methodDeclaration);
|
||||
|
||||
BfIdentifierNode* identifier = methodDeclaration->mNameNode;
|
||||
if (identifier == NULL)
|
||||
return;
|
||||
SetElementType(identifier, BfSourceElementType_Method);
|
||||
|
||||
SetElementType(methodDeclaration->mNameNode, BfSourceElementType_Method);
|
||||
|
||||
if (methodDeclaration->mGenericParams != NULL)
|
||||
{
|
||||
|
@ -485,11 +482,14 @@ void BfSourceClassifier::Visit(BfMethodDeclaration* methodDeclaration)
|
|||
|
||||
if (methodDeclaration->mGenericConstraintsDeclaration != NULL)
|
||||
{
|
||||
for (auto constraint : methodDeclaration->mGenericConstraintsDeclaration->mGenericConstraints)
|
||||
for (auto constraintNode : methodDeclaration->mGenericConstraintsDeclaration->mGenericConstraints)
|
||||
{
|
||||
BfIdentifierNode* typeRef = constraint->mGenericParamName;
|
||||
if (typeRef != NULL)
|
||||
SetElementType(typeRef, BfSourceElementType_TypeRef);
|
||||
if (auto genericConstraint = BfNodeDynCast<BfGenericConstraint>(constraintNode))
|
||||
{
|
||||
BfTypeReference* typeRef = genericConstraint->mTypeRef;
|
||||
if (typeRef != NULL)
|
||||
SetElementType(typeRef, BfSourceElementType_TypeRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -563,9 +563,11 @@ void BfSourceClassifier::Handle(BfTypeDeclaration* typeDeclaration)
|
|||
|
||||
if (typeDeclaration->mGenericConstraintsDeclaration != NULL)
|
||||
{
|
||||
for (auto constraint : typeDeclaration->mGenericConstraintsDeclaration->mGenericConstraints)
|
||||
for (auto constraintNode : typeDeclaration->mGenericConstraintsDeclaration->mGenericConstraints)
|
||||
{
|
||||
BfIdentifierNode* typeRef = constraint->mGenericParamName;
|
||||
auto genericConstraint = BfNodeDynCast<BfGenericConstraint>(constraintNode);
|
||||
|
||||
BfTypeReference* typeRef = genericConstraint->mTypeRef;
|
||||
if (typeRef != NULL)
|
||||
SetElementType(typeRef, BfSourceElementType_TypeRef);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue