Skip to content

Commit

Permalink
fix(VM): conversion operator wrong name extraction.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dich0tomy committed Jun 26, 2022
1 parent 5a7ce59 commit bad55d9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions VM/src/Executors/ExpressionExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,18 @@ auto ExpressionExecutor::evalInfixOperator(std::string_view op_, Action& lhs_, A
auto lhs = evalSide(lhs_);

auto const rhs = rhs_.as<PendingAction>();
if(!rhs->is_type<rigc::Name>())
auto const rhsName = findElem<rigc::Name>(*rhs, false);

// FIXME: this is a qufickfix, need to figure out how to properly handle templated types
if(!rhsName)
throw RigcException("Rhs of the conversion operator should be a valid identifier.")
.withHelp("Check the spelling of the rhs.")
.withLine(vm.lastEvaluatedLine);

auto const rhsType = vm.findType(rhs->string_view());
if(!rhsType)
throw RigcException("Rhs of the conversion operator should be a type.")
.withHelp("Check the spelling of the rhs.")
.withHelp("Check the spelling of the rhs and if the type is in scope.")
.withLine(vm.lastEvaluatedLine);

return vm.tryConvert(lhs, rhsType->shared_from_this());
Expand Down

0 comments on commit bad55d9

Please sign in to comment.