diff --git a/src/headers/SemanticAnalysis.hpp b/src/headers/SemanticAnalysis.hpp index 4257cb0..c126fd6 100644 --- a/src/headers/SemanticAnalysis.hpp +++ b/src/headers/SemanticAnalysis.hpp @@ -24,18 +24,18 @@ private: unordered_task_map getTaskMapInstance() final { // TODO Include line in error messages using namespace StandardComponents; return { - make_nonlocal_task(Reference, + make_nonlocal_task(Function, if (index > 0 and any_of(parsedTree.cbegin(), parsedTree.cbegin() + index + 1, [&parseComponent](const component_ptr& pointer){ - try { - return dynamic_cast&>(*pointer).name == parseComponent.name; - } catch (const bad_cast&) { - return false; + if (pointer->getId() != typeid(Reference)) { + try { + return dynamic_cast&>(*pointer).name == parseComponent.name; + } catch (const bad_cast&) {}; } + return false; })) { error(parseComponent.name + " has already been defined previously"); } ), - share_task(Reference, Function), - share_task(Reference, Class), - share_task(Reference, Define), + share_task(Function, Class), + share_task(Function, Define), }; }; };