1
2
3
4
5
6 #ifndef SNGCPP_BINDER_STATEMENT_BINDER_INCLUDED
7 #define SNGCPP_BINDER_STATEMENT_BINDER_INCLUDED
8 #include <sngcpp/binder/BoundSourceFile.hpp>
9 #include <sngcpp/symbols/SymbolTable.hpp>
10 #include <sngcpp/ast/Visitor.hpp>
11
12 namespace sngcpp { namespace binder {
13
14 class StatementBinder : public sngcpp::ast::Visitor
15 {
16 public:
17 StatementBinder(SymbolTable& symbolTable_, const std::std::unordered_map<SourceFileNode*, BoundSourceFile*>&sourceFileMap_);
18 void Visit(SourceFileNode& sourceFileNode) override;
19 void Visit(SourceFileSequenceNode& sourceFileSequenceNode) override;
20 void Visit(SimpleDeclarationNode& simpleDeclarationNode) override;
21 void Visit(NamespaceNode& namespaceNode) override;
22 void Visit(MemberAccessDeclarationNode& memberAccessDeclarationNode) override;
23 void Visit(MemberDeclarationNode& memberDeclarationNode) override;
24 void Visit(DeclarationSequenceNode& declarationSequenceNode) override;
25 void Visit(LinkageSpecificationNode& linkageSpecificationNode) override;
26 void Visit(TemplateDeclarationNode& templateDeclarationNode) override;
27 void Visit(ClassNode& classNode) override;
28 void Visit(FunctionNode& functionNode) override;
29 void Visit(SpecialMemberFunctionNode& specialMemberFunctionNode) override;
30 void Visit(CompoundStatementNode& compoundStatementNode) override;
31 void Visit(StatementSequenceNode& statementSequenceNode) override;
32 void Visit(LabeledStatementNode& labeledStatementNode) override;
33 void Visit(IfStatementNode& ifStatementNode) override;
34 void Visit(SwitchStatementNode& switchStatementNode) override;
35 void Visit(CaseStatementNode& caseStatementNode) override;
36 void Visit(DefaultStatementNode& defaultStatementNode) override;
37 void Visit(ExpressionStatementNode& expressionStatementNode) override;
38 void Visit(WhileStatementNode& whileStatementNode) override;
39 void Visit(DoStatementNode& doStatementNode) override;
40 void Visit(RangeForStatementNode& rangeForStatementNode) override;
41 void Visit(ForStatementNode& forStatementNode) override;
42 void Visit(ReturnStatementNode& returnStatementNode) override;
43 void Visit(DeclarationStatementNode& declarationStatementNode) override;
44 void Visit(TryStatementNode& tryStatementNode) override;
45 void Visit(HandlerNode& handlerNode) override;
46 void Visit(HandlerSequenceNode& handlerSequenceNode) override;
47 private:
48 SymbolTable& symbolTable;
49 const std::std::unordered_map<SourceFileNode*, BoundSourceFile*>&sourceFileMap;
50 ContainerScope* containerScope;
51 BoundSourceFile* currentSourceFile;
52 FunctionSymbol* currentFunction;
53 };
54
55 } }
56
57 #endif // SNGCPP_BINDER_STATEMENT_BINDER_INCLUDED