Mercurial > projects > ldc
comparison dmd/func.c @ 658:50383e476c7e
Upgraded frontend to DMD 1.035
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Mon, 06 Oct 2008 16:22:11 +0200 |
parents | 49466efd4fba |
children | eef8ac26c66c |
comparison
equal
deleted
inserted
replaced
657:c42173b3557b | 658:50383e476c7e |
---|---|
138 protection = sc->protection; | 138 protection = sc->protection; |
139 storage_class |= sc->stc; | 139 storage_class |= sc->stc; |
140 //printf("function storage_class = x%x\n", storage_class); | 140 //printf("function storage_class = x%x\n", storage_class); |
141 Dsymbol *parent = toParent(); | 141 Dsymbol *parent = toParent(); |
142 | 142 |
143 if (ident == Id::ctor && !isCtorDeclaration()) | |
144 error("_ctor is reserved for constructors"); | |
145 | |
143 if (isConst() || isAuto() || isScope()) | 146 if (isConst() || isAuto() || isScope()) |
144 error("functions cannot be const or auto"); | 147 error("functions cannot be const or auto"); |
145 | 148 |
146 if (isAbstract() && !isVirtual()) | 149 if (isAbstract() && !isVirtual()) |
147 error("non-virtual functions cannot be abstract"); | 150 error("non-virtual functions cannot be abstract"); |
2541 Statements *sa = new Statements(); | 2544 Statements *sa = new Statements(); |
2542 Statement *s = new DeclarationStatement(0, v); | 2545 Statement *s = new DeclarationStatement(0, v); |
2543 sa->push(s); | 2546 sa->push(s); |
2544 Expression *e = new IdentifierExp(0, id); | 2547 Expression *e = new IdentifierExp(0, id); |
2545 e = new AddAssignExp(0, e, new IntegerExp(-1)); | 2548 e = new AddAssignExp(0, e, new IntegerExp(-1)); |
2546 e = new EqualExp(TOKnotequal, 0, e, new IntegerExp(1)); | 2549 e = new EqualExp(TOKnotequal, 0, e, new IntegerExp(0)); |
2547 s = new IfStatement(0, NULL, e, new ReturnStatement(0, NULL), NULL); | 2550 s = new IfStatement(0, NULL, e, new ReturnStatement(0, NULL), NULL); |
2548 sa->push(s); | 2551 sa->push(s); |
2549 if (fbody) | 2552 if (fbody) |
2550 sa->push(fbody); | 2553 sa->push(fbody); |
2551 fbody = new CompoundStatement(0, sa); | 2554 fbody = new CompoundStatement(0, sa); |