Mercurial > projects > ddmd
annotate dmd/SwitchErrorStatement.d @ 191:52188e7e3fb5
Fixed deprecated features, now compiles with DMD2.058
Also changed Array allocation policy:
Now doesn't reallocate but malloc's, followed by a memcpy (no free).
(this fixes a crash while compiling druntime. Same bug in dmd)
author | korDen@korDen-pc |
---|---|
date | Sun, 25 Mar 2012 03:11:12 +0400 |
parents | b0d41ff5e0df |
children |
rev | line source |
---|---|
72 | 1 module dmd.SwitchErrorStatement; |
2 | |
114 | 3 import dmd.common; |
72 | 4 import dmd.Statement; |
5 import dmd.OutBuffer; | |
6 import dmd.Loc; | |
7 import dmd.IRState; | |
0 | 8 import dmd.HdrGenState; |
5
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
9 import dmd.BE; |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
10 |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
11 import dmd.backend.elem; |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
12 import dmd.backend.Blockx; |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
13 import dmd.backend.Util; |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
14 import dmd.backend.TYM; |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
15 import dmd.backend.OPER; |
72 | 16 import dmd.backend.RTLSYM; |
17 | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
18 import dmd.DDMDExtensions; |
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
19 |
0 | 20 class SwitchErrorStatement : Statement |
21 { | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
22 mixin insertMemberExtension!(typeof(this)); |
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
23 |
0 | 24 this(Loc loc) |
25 { | |
178 | 26 register(); |
0 | 27 super(loc); |
28 } | |
29 | |
72 | 30 override BE blockExit() |
0 | 31 { |
5
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
32 return BE.BEthrow; |
0 | 33 } |
34 | |
72 | 35 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
0 | 36 { |
5
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
37 buf.writestring("SwitchErrorStatement.toCBuffer()"); |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
38 buf.writenl(); |
0 | 39 } |
40 | |
72 | 41 override void toIR(IRState* irs) |
0 | 42 { |
5
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
43 elem* e; |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
44 elem* elinnum; |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
45 elem* efilename; |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
46 Blockx* blx = irs.blx; |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
47 |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
48 //printf("SwitchErrorStatement.toIR()\n"); |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
49 |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
50 efilename = blx.module_.toEmodulename(); |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
51 elinnum = el_long(TYM.TYint, loc.linnum); |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
52 e = el_bin(OPER.OPcall, TYM.TYvoid, el_var(rtlsym[RTLSYM_DSWITCHERR]), el_param(elinnum, efilename)); |
63623152e82a
Fixed memory corruption bug which was introduced when attempting to restore GC functionality
dkoroskin <>
parents:
0
diff
changeset
|
53 block_appendexp(blx.curblock, e); |
0 | 54 } |
55 } | |
56 |