compiler/resolution/preFold.cpp
// returns true if the field was instantiated
returns true if the field was instantiated
returns true if the field was instantiated
static bool isInstantiatedField(Symbol* field) {
  TypeSymbol*    ts     = toTypeSymbol(field->defPoint->parentSymbol);
  AggregateType* at     = toAggregateType(ts->type);
  bool           retval = false;
  if (at->hasInitializers()) {
    Symbol* origField = at->getRootInstantiation()->getField(field->name);
    DefExpr* def = origField->defPoint;
    if (field->hasFlag(FLAG_TYPE_VARIABLE)) {
      retval = true;
    } else if (def->exprType == NULL && def->init == NULL) {
      retval = true;
    }
  } else {
    for_formals(formal, at->typeConstructor) {
      if (strcmp(field->name, formal->name) == 0) {
        if (formal->hasFlag(FLAG_TYPE_VARIABLE) == true) {
          retval = true;
          break;
        }
      }
    }
  }
  return retval;
}
static bool isInstantiatedField ( Symbol * field ) { TypeSymbol * ts = toTypeSymbol ( field -> defPoint -> parentSymbol ) ; AggregateType * at = toAggregateType ( ts -> type ) ; bool retval = false ; if ( at -> hasInitializers ( ) ) { Symbol * origField = at -> getRootInstantiation ( ) -> getField ( field -> name ) ; DefExpr * def = origField -> defPoint ; if ( field -> hasFlag ( FLAG_TYPE_VARIABLE ) ) { retval = true ; } else if ( def -> exprType == NULL && def -> init == NULL ) { retval = true ; } } else { for_formals ( formal , at -> typeConstructor ) { if ( strcmp ( field -> name , formal -> name ) == 0 ) { if ( formal -> hasFlag ( FLAG_TYPE_VARIABLE ) == true ) { retval = true ; break ; } } } } return retval ; }
returns true if the field was instantiated
returns true if the field was instantiated
// BHARSH INIT TODO: Sometimes the type constructor is not resolved when // initializers are used. Why? // Fully-generic types are apparently OK?