1 // =================================
 2 // Copyright (c) 2021 Seppo Laakko
 3 // Distributed under the MIT license
 4 // =================================
 5 
 6 #ifndef CMAJOR_BINDER_BOUND_NODE_INCLUDED
 7 #define CMAJOR_BINDER_BOUND_NODE_INCLUDED
 8 #include <cmajor/binder/BinderApi.hpp>
 9 #include <cmajor/ir/GenObject.hpp>
10 #include <cmajor/symbols/Module.hpp>
11 
12 namespace cmajor { namespace binder {
13 
14 using soulng::lexer::Span;
15 using namespace cmajor::ir;
16 using namespace cmajor::symbols;
17 
18 enum class BoundNodeType : uint8_t 
19 {
20     boundCompileUnitboundClassboundFunction
21     boundSequenceStatementboundCompoundStatementboundReturnStatementboundIfStatementboundWhileStatementboundDoStatementboundForStatement
22     boundSwitchStatementboundCaseStatementboundDefaultStatementboundGotoCaseStatementboundGotoDefaultStatementboundBreakStatementboundContinueStatement
23     boundGotoStatementboundConstructionStatementboundAssignmentStatementboundExpressionStatementboundInitializationStatementboundEmptyStatement
24     boundSetVmtPtrStatementboundThrowStatementboundRethrowStatementboundTryStatementboundCatchStatement
25     boundParameterboundLocalVariableboundMemberVariableboundConstantboundEnumConstantboundLiteralboundTemporaryboundBitCastboundFunctionPtrboundConstructAndReturnTemporary
26     boundClassOrClassDelegateConversionResult
27     boundFunctionCallboundDelegateCallboundClassDelegateCallboundConversionboundSizeOfExpressionboundAddressOfExpressionboundDereferenceExpressionboundReferenceToPointerExpression
28     boundConstructExpressionboundIsExpressionboundAsExpressionboundTypeNameExpressionboundTypeIdExpressionboundDisjunctionboundConjunction
29     boundAtomicConstraintboundDisjunctiveConstraintboundConjunctiveConstraintboundConcept
30     boundTypeExpressionboundNamespaceExpressionboundFunctionGroupExpressionboundMemberExpression
31     boundNamespaceboundEnumTypeDefinitionboundGlobalVariable
32 };
33 
34 class BoundNodeVisitor;
35 
36 class BoundNode public GenObject
37 {
38 public:
39     BoundNode(const Span& span_const boost::uuids::uuid& moduleIdBoundNodeType boundNodeType_);
40     virtual void Accept(BoundNodeVisitor& visitor) = 0;
41     const Span& GetSpan() const { return span; }
42     const boost::uuids::uuid& ModuleId() const { return moduleId; }
43     BoundNodeType GetBoundNodeType() const { return boundNodeType; }
44 private:
45     Span span;
46     boost::uuids::uuid moduleId;
47     BoundNodeType boundNodeType;
48 };
49 
50 } } // namespace cmajor::binder
51 
52 #endif // CMAJOR_BINDER_BOUND_NODE_INCLUDED