+2003-05-11 Martin Baulig <martin@ximian.com>
+
+ * statement.cs (Block.CreateSwitchBlock): New method. Creates a
+ new block for a switch section.
+ (Block.AddLabel, Block.LookupLabel): If we're a switch section, do
+ the adding/lookup in the switch block. Fixes #39828.
+
2003-05-09 Miguel de Icaza <miguel@ximian.com>
* expression.cs (UnaryMutator.LoadOneAndEmitOp): Missing
switch_section
: switch_labels
{
- current_block = new Block (current_block, lexer.Location, lexer.Location);
+ current_block = current_block.CreateSwitchBlock (lexer.Location);
}
statement_list
{
// Keeps track of constants
Hashtable constants;
+ //
+ // If this is a switch section, the enclosing switch block.
+ //
+ Block switch_block;
+
bool used = false;
static int id;
statements = new ArrayList ();
}
+ public Block CreateSwitchBlock (Location start)
+ {
+ Block new_block = new Block (this, start, start);
+ new_block.switch_block = this;
+ return new_block;
+ }
+
public int ID {
get {
return this_id;
///
public bool AddLabel (string name, LabeledStatement target)
{
+ if (switch_block != null)
+ return switch_block.AddLabel (name, target);
+
if (labels == null)
labels = new Hashtable ();
if (labels.Contains (name))
public LabeledStatement LookupLabel (string name)
{
+ if (switch_block != null)
+ return switch_block.LookupLabel (name);
+
if (labels != null){
if (labels.Contains (name))
return ((LabeledStatement) labels [name]);