Changeset 785
- Timestamp:
- 12/06/10 07:52:42 (14 years ago)
- Files:
-
- trunk/src/declaration.h (modified) (1 diff)
- trunk/src/func.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/declaration.h
r781 r785 565 565 enum BUILTIN builtin; // set if this is a known, builtin 566 566 // function we can evaluate at compile 567 567 // time 568 568 569 569 int tookAddressOf; // set if someone took the address of 570 570 // this function 571 571 Dsymbols closureVars; // local variables in this function 572 572 // which are referenced by nested 573 573 // functions 574 574 #else 575 575 int nestedFrameRef; // !=0 if nested variables referenced 576 576 #endif 577 577 578 578 FuncDeclaration(Loc loc, Loc endloc, Identifier *id, StorageClass storage_class, Type *type); 579 579 Dsymbol *syntaxCopy(Dsymbol *); 580 580 void semantic(Scope *sc); 581 581 void semantic2(Scope *sc); 582 582 void semantic3(Scope *sc); 583 583 // called from semantic3 584 584 void varArgs(Scope *sc, TypeFunction*, VarDeclaration *&, VarDeclaration *&); 585 int equals(Object *o); 585 586 586 587 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 587 588 void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs); 588 589 int overrides(FuncDeclaration *fd); 589 590 int findVtblIndex(Array *vtbl, int dim); 590 591 int overloadInsert(Dsymbol *s); 591 592 FuncDeclaration *overloadExactMatch(Type *t); 592 593 FuncDeclaration *overloadResolve(Loc loc, Expression *ethis, Expressions *arguments, int flags = 0); 593 594 MATCH leastAsSpecialized(FuncDeclaration *g); 594 595 LabelDsymbol *searchLabel(Identifier *ident); 595 596 AggregateDeclaration *isThis(); 596 597 AggregateDeclaration *isMember2(); 597 598 int getLevel(Loc loc, FuncDeclaration *fd); // lexical nesting level difference 598 599 void appendExp(Expression *e); 599 600 void appendState(Statement *s); 600 601 char *mangle(); 601 602 const char *toPrettyChars(); 602 603 int isMain(); 603 604 int isWinMain(); 604 605 int isDllMain(); trunk/src/func.c
r783 r785 1598 1598 1599 1599 sc2->callSuper = 0; 1600 1600 sc2->pop(); 1601 1601 } 1602 1602 1603 1603 if (global.gag && global.errors != nerrors) 1604 1604 semanticRun = PASSsemanticdone; // Ensure errors get reported again 1605 1605 else 1606 1606 semanticRun = PASSsemantic3done; 1607 1607 } 1608 1608 1609 1609 void FuncDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) 1610 1610 { 1611 1611 //printf("FuncDeclaration::toCBuffer() '%s'\n", toChars()); 1612 1612 1613 1613 StorageClassDeclaration::stcToCBuffer(buf, storage_class); 1614 1614 type->toCBuffer(buf, ident, hgs); 1615 1615 bodyToCBuffer(buf, hgs); 1616 1616 } 1617 1617 1618 int FuncDeclaration::equals(Object *o) 1619 { 1620 if (this == o) 1621 return TRUE; 1622 1623 Dsymbol *s = isDsymbol(o); 1624 if (s) 1625 { 1626 FuncDeclaration *fd = s->isFuncDeclaration(); 1627 if (fd) 1628 { 1629 return toParent()->equals(fd->toParent()) && 1630 ident->equals(fd->ident) && type->equals(fd->type); 1631 } 1632 } 1633 return FALSE; 1634 } 1618 1635 1619 1636 void FuncDeclaration::bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs) 1620 1637 { 1621 1638 if (fbody && 1622 1639 (!hgs->hdrgen || hgs->tpltMember || canInline(1,1)) 1623 1640 ) 1624 1641 { buf->writenl(); 1625 1642 1626 1643 // in{} 1627 1644 if (frequire) 1628 1645 { buf->writestring("in"); 1629 1646 buf->writenl(); 1630 1647 frequire->toCBuffer(buf, hgs); 1631 1648 } 1632 1649 1633 1650 // out{} 1634 1651 if (fensure) 1635 1652 { buf->writestring("out"); 1636 1653 if (outId) 1637 1654 { buf->writebyte('(');
