diff --git a/src/headers/transpiler/Target.hpp b/src/headers/transpiler/Target.hpp index 5c0693d..cac1243 100644 --- a/src/headers/transpiler/Target.hpp +++ b/src/headers/transpiler/Target.hpp @@ -66,12 +66,19 @@ protected: } else output << openCharacters << view << closeCharacters << '\n'; } typedef function task; - #define make_task(X, L) make_pair(type_index(typeid(X)), [this](const ParseTree& parsedTree, unsigned int& index) { const X& parseComponent = pointerAs(parsedTree[index]); L }) + #define make_task_base(type, captures, function_body) make_pair(type_index(typeid(type)), [captures](const ParseTree& parsedTree, unsigned int& index) { const type& parseComponent = pointerAs(parsedTree[index]); function_body }) + #define make_task(T, F) make_task_base(T, this, F) typedef unordered_map> unordered_task_map; virtual unordered_task_map getTaskMap() = 0; public: - unordered_task_map& getTaskMapInstance() { + const unordered_task_map& getTaskMapInstance() { static unordered_task_map staticMap = getTaskMap(); + // Default / Shared tasks: + staticMap.merge(unordered_task_map({ + make_task(StandardComponents::Reference, + output << parseComponent.name; + ) + })); return staticMap; }; static shared_ptr forName(string_view name, bool newLines);