top | up | prev | next

ConstraintChecker Class

Definition at line 145 of Concept.cpp

Constructors

ConstraintChecker(TypeSymbol* firstTypeArgument_, TypeSymbol* secondTypeArgument_, BoundCompileUnit& boundCompileUnit_, ContainerScope* containerScope_, BoundFunction* currentFunction_, const Span& span_, const boost::uuids::uuid& moduleId_, std::unique_ptr<Exception>& exception_)

Member Functions

std::unique_ptr<BoundConstraint> GetBoundConstraint()
TypeSymbol* GetType()
void Reset()
bool Result() const
void Visit(ArrayNode& arrayNode) override
void Visit(BoolNode& boolNode) override
void Visit(ByteNode& byteNode) override
void Visit(CharNode& charNode) override
void Visit(CommonConstraintNode& commonConstraintNode) override
void Visit(ConceptIdNode& conceptIdNode) override
void Visit(ConceptNode& conceptNode) override
void Visit(ConjunctiveConstraintNode& conjunctiveConstraintNode) override
void Visit(ConstNode& constNode) override
void Visit(ConstructorConstraintNode& constructorConstraintNode) override
void Visit(ConvertibleConstraintNode& convertibleConstraintNode) override
void Visit(DerivedConstraintNode& derivedConstraintNode) override
void Visit(DestructorConstraintNode& destructorConstraintNode) override
void Visit(DisjunctiveConstraintNode& disjunctiveConstraintNode) override
void Visit(DotNode& dotNode) override
void Visit(DoubleNode& doubleNode) override
void Visit(ExplicitlyConvertibleConstraintNode& explicitlyConvertibleConstraintNode) override
void Visit(FloatNode& floatNode) override
void Visit(FunctionConstraintNode& functionConstraintNode) override
void Visit(IdentifierNode& identifierNode) override
void Visit(IntNode& intNode) override
void Visit(IsConstraintNode& isConstraintNode) override
void Visit(LValueRefNode& lvalueRefNode) override
void Visit(LongNode& longNode) override
void Visit(MemberFunctionConstraintNode& memberFunctionConstraintNode) override
void Visit(MultiParamConstraintNode& multiParamConstraintNode) override
void Visit(NonreferenceTypeConstraintNode& nonreferenceTypeConstraintNode) override
void Visit(ParenthesizedConstraintNode& parenthesizedConstraintNode) override
void Visit(PointerNode& pointerNode) override
void Visit(PredicateConstraintNode& predicateConstraintNode) override
void Visit(RValueRefNode& rvalueRefNode) override
void Visit(SByteNode& sbyteNode) override
void Visit(SameConstraintNode& sameConstraintNode) override
void Visit(ShortNode& shortNode) override
void Visit(TemplateIdNode& templateIdNode) override
void Visit(TypeNameConstraintNode& typeNameConstraintNode) override
void Visit(UCharNode& ucharNode) override
void Visit(UIntNode& uintNode) override
void Visit(ULongNode& ulongNode) override
void Visit(UShortNode& ushortNode) override
void Visit(VoidNode& voidNode) override
void Visit(WCharNode& wcharNode) override
void Visit(WhereConstraintNode& whereConstraintNode) override

Member Variables

BoundCompileUnit& boundCompileUnit
std::unique_ptr<BoundConstraint> boundConstraint
std::vector<std::unique_ptr<BoundTemplateParameterSymbol>> boundTemplateParameters
ConceptGroupSymbol* conceptGroup
ContainerScope* containerScope
BoundFunction* currentFunction
TypeDerivationRec derivationRec
std::unique_ptr<Exception>& exception
int fileScopesAdded
TypeSymbol* firstTypeArgument
boost::uuids::uuid moduleId
std::vector<std::unique_ptr<NamespaceTypeSymbol>> namespaceTypeSymbols
bool result
TypeSymbol* secondTypeArgument
Span span
SymbolTable& symbolTable
TypeSymbol* type

Constructor Details

ConstraintChecker Constructor

cmajor::binder::ConstraintChecker::ConstraintChecker(TypeSymbol* firstTypeArgument_, TypeSymbol* secondTypeArgument_, BoundCompileUnit & boundCompileUnit_, ContainerScope* containerScope_, BoundFunction * currentFunction_, const Span& span_, const boost::uuids::uuid& moduleId_, std::unique_ptr<Exception>& exception_)

Definition at line 220 of Concept.cpp :
 221 :
 222 firstTypeArgument(firstTypeArgument_)secondTypeArgument(secondTypeArgument_)boundCompileUnit(boundCompileUnit_)symbolTable(boundCompileUnit.GetSymbolTable())
 223 containerScope(containerScope_)currentFunction(currentFunction_)span(span_)moduleId(moduleId_)type(nullptr)derivationRec()conceptGroup(nullptr)result(false)boundConstraint()fileScopesAdded(0)
 224 exception(exception_)
 225 {
 226 }


Declaration at line 148 of Concept.cpp


Member Function Details

GetBoundConstraint Member Function

std::unique_ptr<BoundConstraint > cmajor::binder::ConstraintChecker::GetBoundConstraint()

Definition at line 152 of Concept.cpp :
 152 { return std::move(boundConstraint); }


GetType Member Function

TypeSymbol* cmajor::binder::ConstraintChecker::GetType()

Definition at line 243 of Concept.cpp
Declaration at line 217 of Concept.cpp

Calls: cmajor::binder::BoundCompileUnit::GetSymbolTable , cmajor::symbols::SymbolTable::MakeDerivedType

Called by: cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit


Reset Member Function

void cmajor::binder::ConstraintChecker::Reset()

Definition at line 236 of Concept.cpp :
 237 {
 238     type = nullptr;
 239     derivationRec = TypeDerivationRec();
 240     conceptGroup = nullptr;
 241 }


Declaration at line 216 of Concept.cpp

Called by: cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit , cmajor::binder::ConstraintChecker::Visit


Result Member Function

bool cmajor::binder::ConstraintChecker::Result() const

Definition at line 151 of Concept.cpp :
 151 { return result; }


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ArrayNode& arrayNode) override

Definition at line 372 of Concept.cpp :
 373 {
 374     arrayNode.Subject()->Accept(*this);
 375     if (HasReferenceDerivation(derivationRec.derivations))
 376     {
 377         throw Exception("cannot have array of reference type"arrayNode.GetSpan()arrayNode.ModuleId());
 378     }
 380 }


Declaration at line 172 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(BoolNode& boolNode) override

Definition at line 261 of Concept.cpp :
 262 {
 263     type = symbolTable.GetTypeByName(U"bool");
 264 }


Declaration at line 153 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ByteNode& byteNode) override

Definition at line 271 of Concept.cpp :
 272 {
 273     type = symbolTable.GetTypeByName(U"byte");
 274 }


Declaration at line 155 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(CharNode& charNode) override

Definition at line 316 of Concept.cpp :
 317 {
 318     type = symbolTable.GetTypeByName(U"char");
 319 }


Declaration at line 164 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(CommonConstraintNode& commonConstraintNode) override

Definition at line 1216 of Concept.cpp
Declaration at line 196 of Concept.cpp

Calls: cmajor::binder::BoundCompileUnit::GetConversion


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ConceptIdNode& conceptIdNode) override

Definition at line 1033 of Concept.cpp
Declaration at line 189 of Concept.cpp

Calls: cmajor::binder::BoundCompileUnit::GetConceptRepository , cmajor::binder::BoundConcept::AddBoundTemplateParameter , cmajor::binder::BoundConcept::CommonType , cmajor::binder::BoundConcept::GetBoundConstraint , cmajor::binder::BoundConstraint::Clone , cmajor::binder::ConceptRepository::AddBoundConcept , cmajor::binder::ConceptRepository::GetBoundConcept , cmajor::binder::ConstraintChecker::GetType , cmajor::binder::ConstraintChecker::Reset


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ConceptNode& conceptNode) override

Definition at line 1094 of Concept.cpp
Declaration at line 190 of Concept.cpp

Calls: cmajor::binder::BoundAtomicConstraint::SetConcept , cmajor::binder::ConstraintChecker::Reset


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ConjunctiveConstraintNode& conjunctiveConstraintNode) override

Definition at line 593 of Concept.cpp
Declaration at line 179 of Concept.cpp

Calls: cmajor::binder::ConstraintChecker::Reset


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ConstNode& constNode) override

Definition at line 336 of Concept.cpp :
 337 {
 338     derivationRec.derivations.push_back(Derivation::constDerivation);
 339     constNode.Subject()->Accept(*this);
 340 }


Declaration at line 168 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ConstructorConstraintNode& constructorConstraintNode) override

Definition at line 797 of Concept.cpp
Declaration at line 185 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ConvertibleConstraintNode& convertibleConstraintNode) override

Definition at line 1172 of Concept.cpp
Declaration at line 194 of Concept.cpp

Calls: cmajor::binder::BoundCompileUnit::GetConversion


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(DerivedConstraintNode& derivedConstraintNode) override

Definition at line 1145 of Concept.cpp
Declaration at line 193 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(DestructorConstraintNode& destructorConstraintNode) override

Definition at line 852 of Concept.cpp :
 853 {
 854     result = true;
 855     boundConstraint.reset(new BoundAtomicConstraint(spanmoduleIdtrue));
 856 }


Declaration at line 186 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(DisjunctiveConstraintNode& disjunctiveConstraintNode) override

Definition at line 536 of Concept.cpp
Declaration at line 178 of Concept.cpp

Calls: cmajor::binder::ConstraintChecker::Reset


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(DotNode& dotNode) override

Definition at line 457 of Concept.cpp
Declaration at line 175 of Concept.cpp

Calls: cmajor::binder::BoundCompileUnit::AddFileScope , cmajor::binder::BoundCompileUnit::GetSymbolTable , cmajor::binder::ConstraintChecker::GetType , cmajor::binder::ConstraintChecker::Reset , cmajor::binder::NamespaceTypeSymbol::Ns , cmajor::symbols::ContainerSymbol::GetContainerScope , cmajor::symbols::SymbolTable::SetTypeIdFor


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(DoubleNode& doubleNode) override

Definition at line 311 of Concept.cpp :
 312 {
 313     type = symbolTable.GetTypeByName(U"double");
 314 }


Declaration at line 163 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ExplicitlyConvertibleConstraintNode& explicitlyConvertibleConstraintNode) override

Definition at line 1194 of Concept.cpp
Declaration at line 195 of Concept.cpp

Calls: cmajor::binder::BoundCompileUnit::GetConversion


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(FloatNode& floatNode) override

Definition at line 306 of Concept.cpp :
 307 {
 308     type = symbolTable.GetTypeByName(U"float");
 309 }


Declaration at line 162 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(FunctionConstraintNode& functionConstraintNode) override

Definition at line 916 of Concept.cpp
Declaration at line 188 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(IdentifierNode& identifierNode) override

Definition at line 382 of Concept.cpp
Declaration at line 173 of Concept.cpp

Calls: cmajor::binder::BoundCompileUnit::AddFileScope , cmajor::binder::BoundCompileUnit::FileScopes , cmajor::binder::BoundCompileUnit::GetSymbolTable , cmajor::binder::ConstraintChecker::GetType , cmajor::binder::ConstraintChecker::Reset , cmajor::symbols::SymbolTable::SetTypeIdFor


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(IntNode& intNode) override

Definition at line 286 of Concept.cpp :
 287 {
 288     type = symbolTable.GetTypeByName(U"int");
 289 }


Declaration at line 158 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(IsConstraintNode& isConstraintNode) override

Definition at line 662 of Concept.cpp
Declaration at line 182 of Concept.cpp

Calls: cmajor::binder::BoundCompileUnit::GetConceptRepository , cmajor::binder::BoundConcept::AddBoundTemplateParameter , cmajor::binder::BoundConcept::CommonType , cmajor::binder::BoundConcept::GetBoundConstraint , cmajor::binder::BoundConstraint::Clone , cmajor::binder::ConceptRepository::AddBoundConcept , cmajor::binder::ConceptRepository::GetBoundConcept , cmajor::binder::ConstraintChecker::GetType , cmajor::binder::ConstraintChecker::Reset


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(LValueRefNode& lvalueRefNode) override

Definition at line 342 of Concept.cpp :
 343 {
 344     lvalueRefNode.Subject()->Accept(*this);
 345     if (HasReferenceDerivation(derivationRec.derivations))
 346     {
 347         throw Exception("cannot have reference to reference type"lvalueRefNode.GetSpan()lvalueRefNode.ModuleId());
 348     }
 349     derivationRec.derivations.push_back(Derivation::lvalueRefDerivation);
 350 }


Declaration at line 169 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(LongNode& longNode) override

Definition at line 296 of Concept.cpp :
 297 {
 298     type = symbolTable.GetTypeByName(U"long");
 299 }


Declaration at line 160 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(MemberFunctionConstraintNode& memberFunctionConstraintNode) override

Definition at line 858 of Concept.cpp
Declaration at line 187 of Concept.cpp

Calls: cmajor::binder::ConstraintChecker::GetType , cmajor::binder::ConstraintChecker::Reset


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(MultiParamConstraintNode& multiParamConstraintNode) override

Definition at line 727 of Concept.cpp
Declaration at line 183 of Concept.cpp

Calls: cmajor::binder::BoundCompileUnit::GetConceptRepository , cmajor::binder::BoundConcept::AddBoundTemplateParameter , cmajor::binder::BoundConcept::CommonType , cmajor::binder::BoundConcept::GetBoundConstraint , cmajor::binder::BoundConstraint::Clone , cmajor::binder::ConceptRepository::AddBoundConcept , cmajor::binder::ConceptRepository::GetBoundConcept , cmajor::binder::ConstraintChecker::GetType , cmajor::binder::ConstraintChecker::Reset


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(NonreferenceTypeConstraintNode& nonreferenceTypeConstraintNode) override

Definition at line 1259 of Concept.cpp
Declaration at line 197 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ParenthesizedConstraintNode& parenthesizedConstraintNode) override

Definition at line 530 of Concept.cpp :
 531 {
 532     Reset();
 533     parenthesizedConstraintNode.Constraint()->Accept(*this);
 534 }


Declaration at line 177 of Concept.cpp

Calls: cmajor::binder::ConstraintChecker::Reset


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(PointerNode& pointerNode) override

Definition at line 362 of Concept.cpp :
 363 {
 364     pointerNode.Subject()->Accept(*this);
 365     if (HasReferenceDerivation(derivationRec.derivations))
 366     {
 367         throw Exception("cannot have pointer to reference type"pointerNode.GetSpan()pointerNode.ModuleId());
 368     }
 369     derivationRec.derivations.push_back(Derivation::pointerDerivation);
 370 }


Declaration at line 171 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(PredicateConstraintNode& predicateConstraintNode) override

Definition at line 651 of Concept.cpp :
 652 {
 653     Reset();
 654     Node* invokeExprNode = predicateConstraintNode.InvokeExpr();
 655     std::unique_ptr<Value> evaluationResult = Evaluate(invokeExprNodesymbolTable.GetTypeByName(U"bool")containerScopeboundCompileUnitfalsecurrentFunction
 656         predicateConstraintNode.GetSpan()predicateConstraintNode.ModuleId());
 657     BoolValue* boolResult = static_cast<BoolValue*>(evaluationResult.get());
 658     result = boolResult->GetValue();
 659     boundConstraint.reset(new BoundAtomicConstraint(predicateConstraintNode.GetSpan()predicateConstraintNode.ModuleId()result));
 660 }


Declaration at line 181 of Concept.cpp

Calls: cmajor::binder::ConstraintChecker::Reset


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(RValueRefNode& rvalueRefNode) override

Definition at line 352 of Concept.cpp :
 353 {
 354     rvalueRefNode.Subject()->Accept(*this);
 355     if (HasReferenceDerivation(derivationRec.derivations))
 356     {
 357         throw Exception("cannot have reference to reference type"rvalueRefNode.GetSpan()rvalueRefNode.ModuleId());
 358     }
 359     derivationRec.derivations.push_back(Derivation::rvalueRefDerivation);
 360 }


Declaration at line 170 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(SByteNode& sbyteNode) override

Definition at line 266 of Concept.cpp :
 267 {
 268     type = symbolTable.GetTypeByName(U"sbyte");
 269 }


Declaration at line 154 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(SameConstraintNode& sameConstraintNode) override

Definition at line 1124 of Concept.cpp
Declaration at line 192 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ShortNode& shortNode) override

Definition at line 276 of Concept.cpp :
 277 {
 278     type = symbolTable.GetTypeByName(U"short");
 279 }


Declaration at line 156 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(TemplateIdNode& templateIdNode) override

Definition at line 452 of Concept.cpp :
 453 {
 454     type = ResolveType(&templateIdNodeboundCompileUnitcontainerScope);
 455 }


Declaration at line 174 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(TypeNameConstraintNode& typeNameConstraintNode) override

Definition at line 788 of Concept.cpp :
 789 {
 790     Reset();
 791     typeNameConstraintNode.TypeId()->Accept(*this);
 792     TypeSymbol* resolvedType = GetType();
 793     result = resolvedType != nullptr;
 794     boundConstraint.reset(new BoundAtomicConstraint(spanmoduleIdresult));
 795 }


Declaration at line 184 of Concept.cpp

Calls: cmajor::binder::ConstraintChecker::GetType , cmajor::binder::ConstraintChecker::Reset


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(UCharNode& ucharNode) override

Definition at line 326 of Concept.cpp :
 327 {
 328     type = symbolTable.GetTypeByName(U"uchar");
 329 }


Declaration at line 166 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(UIntNode& uintNode) override

Definition at line 291 of Concept.cpp :
 292 {
 293     type = symbolTable.GetTypeByName(U"uint");
 294 }


Declaration at line 159 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(ULongNode& ulongNode) override

Definition at line 301 of Concept.cpp :
 302 {
 303     type = symbolTable.GetTypeByName(U"ulong");
 304 }


Declaration at line 161 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(UShortNode& ushortNode) override

Definition at line 281 of Concept.cpp :
 282 {
 283     type = symbolTable.GetTypeByName(U"ushort");
 284 }


Declaration at line 157 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(VoidNode& voidNode) override

Definition at line 331 of Concept.cpp :
 332 {
 333     type = symbolTable.GetTypeByName(U"void");
 334 }


Declaration at line 167 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(WCharNode& wcharNode) override

Definition at line 321 of Concept.cpp :
 322 {
 323     type = symbolTable.GetTypeByName(U"wchar");
 324 }


Declaration at line 165 of Concept.cpp


Visit Member Function

void cmajor::binder::ConstraintChecker::Visit(WhereConstraintNode& whereConstraintNode) override

Definition at line 645 of Concept.cpp :
 646 {
 647     Reset();
 648     whereConstraintNode.Constraint()->Accept(*this);
 649 }


Declaration at line 180 of Concept.cpp

Calls: cmajor::binder::ConstraintChecker::Reset


top | up | prev | next