CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
TypeConverter.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Visitor.hpp"
11
14
15#include <functional>
16
18
22
23 // Helper class to update the type denoters of all 'TypedAST' nodes, whose type denoters have been reset.
24 class TypeConverter : public Visitor {
25 public:
26 // Callback interface for each variable declaration, which returns true if its type has changed (i.e. type denoter has been reset).
27 using OnVisitVarDeclaration = Function<bool(VarDeclaration& varDeclaration) const>;
28
29 private:
31
32 bool mResetExpressionTypes = false; // If true, all expression types must be reset.
33 Set<AST*> mConvertedSymbols; // List of all symbols, whose type denoters have been reset.
34
35 public:
36 // Converts the type denoters in the specified AST.
38
39 private:
41 void convertExpression(const ExpressionPtr& expression);
42
43 private: // Visitor implementation
45
53
66 };
67
68} // namespace CeresEngine::ShaderCompiler
#define DECLARATION_VISIT_PROC(CLASS_NAME)
Definition Visitor.hpp:88
Definition TypeConverter.hpp:24
Set< AST * > mConvertedSymbols
Definition TypeConverter.hpp:33
void convertExpressionType(Expression *expression)
Function< bool(VarDeclaration &varDeclaration) const > OnVisitVarDeclaration
Definition TypeConverter.hpp:27
void convertExpression(const ExpressionPtr &expression)
void convert(Program &program, const OnVisitVarDeclaration &onVisitVarDeclaration)
OnVisitVarDeclaration mOnVisitVarDeclaration
Definition TypeConverter.hpp:30
bool mResetExpressionTypes
Definition TypeConverter.hpp:32
Definition Visitor.hpp:92
Definition AST.hpp:33
SPtr< Expression > ExpressionPtr
Definition Visitor.hpp:26
FunctionBase< true, true, fu2::capacity_default, true, false, Signatures... > Function
An owning copyable function wrapper for arbitrary callable types.
Definition Function.hpp:54
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
std::set< Key, Compare, ScopedAllocatorAdaptor< StdAllocator< Key, RawAllocator > > > Set
Set is an associative container that contains a sorted set of unique objects of type Key.
Definition Set.hpp:21
Definition AST.hpp:1159