Mercurial > projects > ddmd
comparison dmd/SwitchStatement.d @ 178:e3afd1303184
Many small bugs fixed
Made all classes derive from TObject to detect memory leaks (functionality is disabled for now)
Began work on overriding backend memory allocations (to avoid memory leaks)
author | korDen |
---|---|
date | Sun, 17 Oct 2010 07:42:00 +0400 |
parents | af724d3510d7 |
children | 0622fff7810a |
comparison
equal
deleted
inserted
replaced
177:1475fd394c9e | 178:e3afd1303184 |
---|---|
67 int hasNoDefault = 0; // !=0 if no default statement | 67 int hasNoDefault = 0; // !=0 if no default statement |
68 int hasVars = 0; // !=0 if has variable case values | 68 int hasVars = 0; // !=0 if has variable case values |
69 | 69 |
70 this(Loc loc, Expression c, Statement b, bool isFinal) | 70 this(Loc loc, Expression c, Statement b, bool isFinal) |
71 { | 71 { |
72 register(); | |
72 super(loc); | 73 super(loc); |
73 | 74 |
74 this.condition = c; | 75 this.condition = c; |
75 this.body_ = b; | 76 this.body_ = b; |
76 this.isFinal = isFinal; | 77 this.isFinal = isFinal; |
484 string = 0; | 485 string = 0; |
485 block_appendexp(mystate.switchBlock, econd); | 486 block_appendexp(mystate.switchBlock, econd); |
486 block_next(blx,BCswitch,null); | 487 block_next(blx,BCswitch,null); |
487 | 488 |
488 // Corresponding free is in block_free | 489 // Corresponding free is in block_free |
489 targ_llong* pu = cast(targ_llong*) malloc(targ_llong.sizeof * (numcases + 1)); | 490 targ_llong* pu = cast(targ_llong*) GC.malloc(targ_llong.sizeof * (numcases + 1)); |
490 mystate.switchBlock.Bswitch = pu; | 491 mystate.switchBlock.Bswitch = pu; |
491 /* First pair is the number of cases, and the default block | 492 /* First pair is the number of cases, and the default block |
492 */ | 493 */ |
493 *pu++ = numcases; | 494 *pu++ = numcases; |
494 list_append(&mystate.switchBlock.Bsucc, mystate.defaultBlock); | 495 list_append(&mystate.switchBlock.Bsucc, mystate.defaultBlock); |