Skip to content

Commit

Permalink
Type Inference
Browse files Browse the repository at this point in the history
* added 'Void' to the basic type lookup table
  - needed for 'RuleRef' syntax to specify correct and full rule
    reference relation types
  - forwarding of indirect rule expression types to the upper node
  - related to ref sealangdotorg/sea#20
  • Loading branch information
ppaulweber committed Apr 19, 2017
1 parent 40d0406 commit 3785a65
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/analyze/TypeInferencePass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ static const auto RATIONAL = libstdhl::get< libcasm_ir::RationalType >();

static const std::unordered_map< std::string, libcasm_ir::Type::Ptr > basicTypes
= {
{ "Void", VOID },

{ "RuleRef", RULEREF },

{ "Boolean", BOOLEAN },
Expand Down Expand Up @@ -764,15 +766,16 @@ void TypeInferenceVisitor::visit( DirectCallExpression& node )

void TypeInferenceVisitor::visit( IndirectCallExpression& node )
{
// POSTORDER
RecursiveVisitor::visit( node );

if( not node.type() )
if( not node.expression()->type() )
{
m_err++;
m_log.error( { node.sourceLocation() },
"unable to resolve type of indirect call expression" );
}

node.setType( node.expression()->type() );
}

void TypeInferenceVisitor::visit( UnaryExpression& node )
Expand Down

0 comments on commit 3785a65

Please sign in to comment.