void mergeTypes( const std::string& strType1, ObjectType eType1, const std::string& strType2, ObjectType eType2, std::string& strType, ObjectType& eType ) { if ( strType1.empty() || strType2.empty() ) { strType = ""; eType = OT_Null; return; } if ( eType2 == OT_Null ) { if (eType1 == OT_Null) { strType = strType2; eType = OT_Null; return; } mergeTypes( strType2, eType2, strType1, eType1, strType, eType ); return; } if ( eType1 == OT_Null && eType2 == OT_Folder || eType1 != OT_Null && eType1 != eType2 ) { strType = ""; eType = OT_Null; return; } strType = strType2; eType = eType2; }
void Loop::finalize() { if (!out.is()) { type = body->type; return; } TypeSeeker seeker(this, this->out); type = mergeTypes(seeker.types); }
void Block::finalize() { if (!name.is()) { // nothing branches here, so this is easy if (list.size() > 0) { type = list.back()->type; } else { type = unreachable; } return; } TypeSeeker seeker(this, this->name); type = mergeTypes(seeker.types); }