From 4512909b233d7b5e2b9f90c61f163bc5fd321542 Mon Sep 17 00:00:00 2001 From: Username404 Date: Sat, 31 Jul 2021 18:56:17 +0200 Subject: [PATCH] Don't break in the ADDTARGET macro of Target.hpp, and define class names of Py.hpp, Lua.hpp and Js.hpp to use them in Target.hpp. --- src/headers/transpiler/Target.hpp | 23 +++++++++++-------- src/headers/transpiler/implementations/Js.hpp | 2 +- .../transpiler/implementations/Lua.hpp | 2 +- src/headers/transpiler/implementations/Py.hpp | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/headers/transpiler/Target.hpp b/src/headers/transpiler/Target.hpp index dc6572b..c3c6395 100644 --- a/src/headers/transpiler/Target.hpp +++ b/src/headers/transpiler/Target.hpp @@ -36,17 +36,20 @@ shared_ptr Target::forName(string_view name) { } } shared_ptr target; - #define ADDTARGET(X) target = make_shared(X()); break; + #define ADDTARGET(X) target = make_shared(X()); switch (selected) { -#ifdef LUA_HPP - case LUA: ADDTARGET(LuaTarget) -#endif -#ifdef JS_HPP - case JS: ADDTARGET(JsTarget) -#endif -#ifdef PY_HPP - case PY: ADDTARGET(PyTarget) -#endif + case LUA: + #ifdef LUA_HPP + ADDTARGET(LUA_HPP); break; + #endif + case JS: + #ifdef JS_HPP + ADDTARGET(JS_HPP); break; + #endif + case PY: + #ifdef PY_HPP + ADDTARGET(PY_HPP); break; + #endif case NONE: default: { if (not name.empty()) { diff --git a/src/headers/transpiler/implementations/Js.hpp b/src/headers/transpiler/implementations/Js.hpp index 925b63b..ab0aa2e 100644 --- a/src/headers/transpiler/implementations/Js.hpp +++ b/src/headers/transpiler/implementations/Js.hpp @@ -1,5 +1,5 @@ #ifndef JS_HPP -#define JS_HPP +#define JS_HPP JsTarget struct JsTarget: Target {}; diff --git a/src/headers/transpiler/implementations/Lua.hpp b/src/headers/transpiler/implementations/Lua.hpp index 1cb00e7..b059062 100644 --- a/src/headers/transpiler/implementations/Lua.hpp +++ b/src/headers/transpiler/implementations/Lua.hpp @@ -1,5 +1,5 @@ #ifndef LUA_HPP -#define LUA_HPP +#define LUA_HPP LuaTarget struct LuaTarget: Target {}; diff --git a/src/headers/transpiler/implementations/Py.hpp b/src/headers/transpiler/implementations/Py.hpp index e9c9fb9..a5d14ec 100644 --- a/src/headers/transpiler/implementations/Py.hpp +++ b/src/headers/transpiler/implementations/Py.hpp @@ -1,5 +1,5 @@ #ifndef PY_HPP -#define PY_HPP +#define PY_HPP PyTarget struct PyTarget: Target {};