Skip to content

Commit

Permalink
2002-07-26 Martin Baulig <martin@gnome.org>
Browse files Browse the repository at this point in the history
	* cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
	(switch_statement): Push the current_block to the switch_stack and
	pop it again when we're done with the switch.
	(switch_section): The new block is an implicit child of the
	current_block.  Fixes bug #24007, added test-152.cs.

svn path=/trunk/mcs/; revision=6181
  • Loading branch information
Martin Baulig committed Jul 25, 2002
1 parent 28f14aa commit 95f88c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
8 changes: 8 additions & 0 deletions mcs/mcs/ChangeLog
@@ -1,3 +1,11 @@
2002-07-26 Martin Baulig <martin@gnome.org>

* cs-parser.jay (CSharpParser): Added `Stack switch_stack'.
(switch_statement): Push the current_block to the switch_stack and
pop it again when we're done with the switch.
(switch_section): The new block is an implicit child of the
current_block. Fixes bug #24007, added test-152.cs.

2002-07-25 Miguel de Icaza <miguel@ximian.com>

* driver.cs: Rename --resource to --linkres, because that is what
Expand Down
13 changes: 9 additions & 4 deletions mcs/mcs/cs-parser.jay
Expand Up @@ -68,6 +68,11 @@ namespace Mono.CSharp
// An out-of-band stack.
//
Stack oob_stack;

//
// Switch stack.
//
Stack switch_stack;
%}

%token EOF
Expand Down Expand Up @@ -2907,11 +2912,13 @@ switch_statement
: SWITCH OPEN_PARENS
{
oob_stack.Push (lexer.Location);
switch_stack.Push (current_block);
}
expression CLOSE_PARENS
switch_block
{
$$ = new Switch ((Expression) $4, (ArrayList) $6, (Location) oob_stack.Pop ());
current_block = (Block) switch_stack.Pop ();
}
;

Expand Down Expand Up @@ -2952,14 +2959,11 @@ switch_sections
switch_section
: switch_labels
{
current_block = new Block (current_block);
current_block = new Block (current_block, true);
}
statement_list
{
while (current_block.Implicit)
current_block = current_block.Parent;
$$ = new SwitchSection ((ArrayList) $1, current_block);
current_block = current_block.Parent;
}
;

Expand Down Expand Up @@ -3906,6 +3910,7 @@ public CSharpParser (string name, System.IO.Stream input, ArrayList defines)
current_container = RootContext.Tree.Types;
current_container.Namespace = current_namespace;
oob_stack = new Stack ();
switch_stack = new Stack ();

lexer = new Tokenizer (input, name, defines);
}
Expand Down

0 comments on commit 95f88c8

Please sign in to comment.