compiler/resolution/preFold.cpp
/*
  Creates the parent class which will represent the function's type.
  Children of the parent class will capture different functions which
  happen to share the same function type.  By using the parent class
  we can assign new values onto variable that match the function type
  but may currently be pointing at a different function.
*/
Creates the parent class which will represent the function's type.
Children of the parent class will capture different functions which
happen to share the same function type.  By using the parent class
we can assign new values onto variable that match the function type
but may currently be pointing at a different function.
Creates the parent class which will represent the function ' s type . Children of the parent class will capture different functions which happen to share the same function type . By using the parent class we can assign new values onto variable that match the function type but may currently be pointing at a different function .
static AggregateType* createAndInsertFunParentClass(CallExpr*   call,
                                                    const char* name) {
  AggregateType* parent   = new AggregateType(AGGREGATE_CLASS);
  TypeSymbol*    parentTs = new TypeSymbol(name, parent);
  parentTs->addFlag(FLAG_FUNCTION_CLASS);
  theProgram->block->body.insertAtTail(new DefExpr(parentTs));
  parent->dispatchParents.add(dtObject);
  dtObject->dispatchChildren.add(parent);
  VarSymbol* parentSuper = new VarSymbol("super", dtObject);
  parentSuper->addFlag(FLAG_SUPER_CLASS);
  parent->fields.insertAtHead(new DefExpr(parentSuper));
  parent->buildTypeConstructor();
  parent->buildDefaultInitializer();
  buildDefaultDestructor(parent);
  return parent;
}
static AggregateType * createAndInsertFunParentClass ( CallExpr * call , const char * name ) { AggregateType * parent = new AggregateType ( AGGREGATE_CLASS ) ; TypeSymbol * parentTs = new TypeSymbol ( name , parent ) ; parentTs -> addFlag ( FLAG_FUNCTION_CLASS ) ; theProgram -> block -> body . insertAtTail ( new DefExpr ( parentTs ) ) ; parent -> dispatchParents . add ( dtObject ) ; dtObject -> dispatchChildren . add ( parent ) ; VarSymbol * parentSuper = new VarSymbol ( " " , dtObject ) ; parentSuper -> addFlag ( FLAG_SUPER_CLASS ) ; parent -> fields . insertAtHead ( new DefExpr ( parentSuper ) ) ; parent -> buildTypeConstructor ( ) ; parent -> buildDefaultInitializer ( ) ; buildDefaultDestructor ( parent ) ; return parent ; }
Creates the parent class which will represent the function's type.
Creates the parent class which will represent the function ' s type .
// Because this function type needs to be globally visible (because // we don't know the modules it will be passed to), we put it at the // highest scope