Mercurial > projects > ddmd
comparison dmd/StructDeclaration.d @ 126:1765f3ef917d
ClassDeclarations, Arguments -> Vector
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Fri, 03 Sep 2010 23:25:55 +0100 |
parents | e28b18c23469 |
children | 010eb8f0e18d |
comparison
equal
deleted
inserted
replaced
125:767a01c2a272 | 126:1765f3ef917d |
---|---|
229 * int opCmp(struct *p) { return opCmp(*p); } | 229 * int opCmp(struct *p) { return opCmp(*p); } |
230 */ | 230 */ |
231 | 231 |
232 TypeFunction tfeqptr; | 232 TypeFunction tfeqptr; |
233 { | 233 { |
234 Arguments arguments = new Arguments; | 234 auto arguments = new Arguments; |
235 Argument arg = new Argument(STC.STCin, handle, Id.p, null); | 235 auto arg = new Argument(STC.STCin, handle, Id.p, null); |
236 | 236 |
237 arguments.push(cast(void*)arg); | 237 arguments.push(arg); |
238 tfeqptr = new TypeFunction(arguments, Type.tint32, 0, LINK.LINKd); | 238 tfeqptr = new TypeFunction(arguments, Type.tint32, 0, LINK.LINKd); |
239 tfeqptr = cast(TypeFunction)tfeqptr.semantic(Loc(0), sc); | 239 tfeqptr = cast(TypeFunction)tfeqptr.semantic(Loc(0), sc); |
240 } | 240 } |
241 | 241 |
242 TypeFunction tfeq; | 242 TypeFunction tfeq; |
243 { | 243 { |
244 Arguments arguments = new Arguments; | 244 auto arguments = new Arguments; |
245 Argument arg = new Argument(STC.STCin, type, null, null); | 245 auto arg = new Argument(STC.STCin, type, null, null); |
246 | 246 |
247 arguments.push(cast(void*)arg); | 247 arguments.push(arg); |
248 tfeq = new TypeFunction(arguments, Type.tint32, 0, LINK.LINKd); | 248 tfeq = new TypeFunction(arguments, Type.tint32, 0, LINK.LINKd); |
249 tfeq = cast(TypeFunction)tfeq.semantic(Loc(0), sc); | 249 tfeq = cast(TypeFunction)tfeq.semantic(Loc(0), sc); |
250 } | 250 } |
251 | 251 |
252 Identifier id = Id.eq; | 252 Identifier id = Id.eq; |
435 | 435 |
436 //printf("StructDeclaration.buildOpAssign() %s\n", toChars()); | 436 //printf("StructDeclaration.buildOpAssign() %s\n", toChars()); |
437 | 437 |
438 FuncDeclaration fop = null; | 438 FuncDeclaration fop = null; |
439 | 439 |
440 Argument param = new Argument(STC.STCnodtor, type, Id.p, null); | 440 auto param = new Argument(STC.STCnodtor, type, Id.p, null); |
441 Arguments fparams = new Arguments; | 441 auto fparams = new Arguments; |
442 fparams.push(cast(void*)param); | 442 fparams.push(param); |
443 Type ftype = new TypeFunction(fparams, handle, false, LINK.LINKd); | 443 Type ftype = new TypeFunction(fparams, handle, false, LINK.LINKd); |
444 version (STRUCTTHISREF) { | 444 version (STRUCTTHISREF) { |
445 (cast(TypeFunction)ftype).isref = 1; | 445 (cast(TypeFunction)ftype).isref = 1; |
446 } | 446 } |
447 | 447 |
650 */ | 650 */ |
651 if (postblit) | 651 if (postblit) |
652 { | 652 { |
653 //printf("generating cpctor\n"); | 653 //printf("generating cpctor\n"); |
654 | 654 |
655 Argument param = new Argument(STC.STCref, type, Id.p, null); | 655 auto param = new Argument(STC.STCref, type, Id.p, null); |
656 Arguments fparams = new Arguments; | 656 auto fparams = new Arguments; |
657 fparams.push(cast(void*)param); | 657 fparams.push(param); |
658 Type ftype = new TypeFunction(fparams, Type.tvoid, false, LINK.LINKd); | 658 Type ftype = new TypeFunction(fparams, Type.tvoid, false, LINK.LINKd); |
659 | 659 |
660 fcp = new FuncDeclaration(Loc(0), Loc(0), Id.cpctor, STC.STCundefined, ftype); | 660 fcp = new FuncDeclaration(Loc(0), Loc(0), Id.cpctor, STC.STCundefined, ftype); |
661 | 661 |
662 // Build *this = p; | 662 // Build *this = p; |
663 Expression e = new ThisExp(Loc(0)); | 663 Expression e = new ThisExp(Loc(0)); |
664 version (STRUCTTHISREF) { | 664 version (STRUCTTHISREF) { |
665 } else { | 665 } else { |
666 e = new PtrExp(Loc(0), e); | 666 e = new PtrExp(Loc(0), e); |
667 } | 667 } |
668 AssignExp ea = new AssignExp(Loc(0), e, new IdentifierExp(Loc(0), Id.p)); | 668 auto ea = new AssignExp(Loc(0), e, new IdentifierExp(Loc(0), Id.p)); |
669 ea.op = TOK.TOKblit; | 669 ea.op = TOK.TOKblit; |
670 Statement s = new ExpStatement(Loc(0), ea); | 670 Statement s = new ExpStatement(Loc(0), ea); |
671 | 671 |
672 // Build postBlit(); | 672 // Build postBlit(); |
673 e = new VarExp(Loc(0), postblit, 0); | 673 e = new VarExp(Loc(0), postblit, 0); |