compiler/AST/foralls.cpp
//
// Given an iterator function, find the type that it yields.
// It would be fn->retType, alas protoIteratorClass() messes with that.
// This helper is ForallStmt-specific because of the assumptions it makes.
//
Given an iterator function, find the type that it yields.
It would be fn->retType, alas protoIteratorClass() messes with that.
This helper is ForallStmt-specific because of the assumptions it makes.
Given an iterator function find the type that it yields . It would be fn - > retType alas protoIteratorClass () messes with that . This helper is ForallStmt - specific because of the assumptions it makes .
static QualifiedType fsIterYieldType(ForallStmt* fs, FnSymbol* iterFn,
                                     FnSymbol* origIterFn,
                                     bool alreadyResolved)
{
  if (iterFn->isIterator()) {
    if (IteratorInfo* ii = iterFn->iteratorInfo) {
      return ii->getValue->getReturnQualType();
    } else {
      INT_ASSERT(alreadyResolved);
      return buildIterYieldType(fs, iterFn, origIterFn);
    }
  } else {
    AggregateType* retType = toAggregateType(iterFn->retType);
    INT_ASSERT(retType && retType->symbol->hasFlag(FLAG_ITERATOR_RECORD));
    FnSymbol* iterator = retType->iteratorInfo->iterator;
    INT_ASSERT(iterator->isIterator()); 
    return fsIterYieldType(fs, iterator, origIterFn, alreadyResolved);
  }
}
static QualifiedType fsIterYieldType ( ForallStmt * fs , FnSymbol * iterFn , FnSymbol * origIterFn , bool alreadyResolved ) { if ( iterFn -> isIterator ( ) ) { if ( IteratorInfo * ii = iterFn -> iteratorInfo ) { return ii -> getValue -> getReturnQualType ( ) ; } else { INT_ASSERT ( alreadyResolved ) ; return buildIterYieldType ( fs , iterFn , origIterFn ) ; } } else { AggregateType * retType = toAggregateType ( iterFn -> retType ) ; INT_ASSERT ( retType && retType -> symbol -> hasFlag ( FLAG_ITERATOR_RECORD ) ) ; FnSymbol * iterator = retType -> iteratorInfo -> iterator ; INT_ASSERT ( iterator -> isIterator ( ) ) ; return fsIterYieldType ( fs , iterator , origIterFn , alreadyResolved ) ; } }
Given an iterator function, find the type that it yields.
Given an iterator function find the type that it yields .
// We are in the midst of resolving a recursive iterator. // e.g. "proc these() return _value.these();" // no more recursion?