Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
625d0ab2
Commit
625d0ab2
authored
Jan 24, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Simple statement in type switch is in different block.
From-SVN: r183496
parent
1efaf134
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
gcc/go/gofrontend/parse.cc
+24
-2
No files found.
gcc/go/gofrontend/parse.cc
View file @
625d0ab2
...
...
@@ -4057,6 +4057,7 @@ Parse::switch_stat(Label* label)
Expression
*
switch_val
=
NULL
;
bool
saw_send_stmt
;
Type_switch
type_switch
;
bool
have_type_switch_block
=
false
;
if
(
this
->
simple_stat_may_start_here
())
{
switch_val
=
this
->
simple_stat
(
false
,
&
saw_send_stmt
,
NULL
,
...
...
@@ -4099,7 +4100,14 @@ Parse::switch_stat(Label* label)
id_loc
));
if
(
is_coloneq
)
{
// This must be a TypeSwitchGuard.
// This must be a TypeSwitchGuard. It is in a
// different block from any initial SimpleStat.
if
(
saw_simple_stat
)
{
this
->
gogo_
->
start_block
(
id_loc
);
have_type_switch_block
=
true
;
}
switch_val
=
this
->
simple_stat
(
false
,
&
saw_send_stmt
,
NULL
,
&
type_switch
);
if
(
!
type_switch
.
found
)
...
...
@@ -4142,13 +4150,23 @@ Parse::switch_stat(Label* label)
if
(
this
->
peek_token
()
->
is_op
(
OPERATOR_SEMICOLON
))
this
->
advance_token
();
if
(
!
this
->
peek_token
()
->
is_op
(
OPERATOR_LCURLY
))
return
;
{
if
(
have_type_switch_block
)
this
->
gogo_
->
add_block
(
this
->
gogo_
->
finish_block
(
location
),
location
);
this
->
gogo_
->
add_block
(
this
->
gogo_
->
finish_block
(
location
),
location
);
return
;
}
if
(
type_switch
.
found
)
type_switch
.
expr
=
Expression
::
make_error
(
location
);
}
else
{
error_at
(
this
->
location
(),
"expected %<{%>"
);
if
(
have_type_switch_block
)
this
->
gogo_
->
add_block
(
this
->
gogo_
->
finish_block
(
this
->
location
()),
location
);
this
->
gogo_
->
add_block
(
this
->
gogo_
->
finish_block
(
this
->
location
()),
location
);
return
;
...
...
@@ -4165,6 +4183,10 @@ Parse::switch_stat(Label* label)
if
(
statement
!=
NULL
)
this
->
gogo_
->
add_statement
(
statement
);
if
(
have_type_switch_block
)
this
->
gogo_
->
add_block
(
this
->
gogo_
->
finish_block
(
this
->
location
()),
location
);
this
->
gogo_
->
add_block
(
this
->
gogo_
->
finish_block
(
this
->
location
()),
location
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment