Mercurial > projects > ldc
comparison ir/irlandingpad.cpp @ 355:d8357f7004ca trunk
[svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
It is now possible to add label scopes in IrFunction and all labels names will be prefixed accordingly.
Also disallow goto into finally blocks.
Fixes nocompile/finally_02 and others.
author | ChristianK |
---|---|
date | Mon, 14 Jul 2008 11:48:55 +0200 |
parents | d22d8d63c1fd |
children | 672eb4893b55 |
comparison
equal
deleted
inserted
replaced
354:ac654d4cb935 | 355:d8357f7004ca |
---|---|
148 // if it's a finally, emit its code | 148 // if it's a finally, emit its code |
149 if(it->finallyBody) | 149 if(it->finallyBody) |
150 { | 150 { |
151 if(switchinst) | 151 if(switchinst) |
152 switchinst = NULL; | 152 switchinst = NULL; |
153 | |
154 // since this may be emitted multiple times | |
155 // give the labels a new scope | |
156 gIR->func()->pushUniqueLabelScope("finally"); | |
153 it->finallyBody->toIR(gIR); | 157 it->finallyBody->toIR(gIR); |
158 gIR->func()->popLabelScope(); | |
154 } | 159 } |
155 // otherwise it's a catch and we'll add a switch case | 160 // otherwise it's a catch and we'll add a switch case |
156 else | 161 else |
157 { | 162 { |
158 if(!switchinst) | 163 if(!switchinst) |