MCPcopy Create free account
hub / github.com/covscript/covscript / try_fix_this_deduction

Method try_fix_this_deduction

sources/compiler/compiler.cpp:1050–1067  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1048 }
1049
1050 void compiler_type::try_fix_this_deduction(cs::tree_type<cs::token_base *>::iterator it)
1051 {
1052 if (!it.usable())
1053 return;
1054 token_signal *sig = dynamic_cast<token_signal *>(it.data());
1055 if (sig == nullptr || sig->get_signal() != signal_types::dot_)
1056 return;
1057 token_id *id = dynamic_cast<token_id *>(it.left().data());
1058 if (id == nullptr || id->get_id().get_id() != "this")
1059 return;
1060 // Check if it was generated by AST trimmer
1061 if (it.left().left().usable() && it.left().left().data() != nullptr &&
1062 it.left().left().data() == it.right().data()) {
1063 // it.data() = it.right().data();
1064 throw compile_error(std::string("Symbol collision with structure member \"") +
1065 static_cast<token_id *>(it.right().data())->get_id().get_id() + "\".");
1066 }
1067 }
1068
1069 void compiler_type::import_csym(const std::string &module_path, const std::string &csym_path)
1070 {

Callers 1

preprocessMethod · 0.80

Calls 6

compile_errorClass · 0.85
dataMethod · 0.80
get_signalMethod · 0.80
leftMethod · 0.80
rightMethod · 0.80
usableMethod · 0.45

Tested by

no test coverage detected