Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
7a42dddb
Commit
7a42dddb
authored
Dec 02, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: fix line number for redundant print
R=ken2 CC=golang-dev
https://golang.org/cl/5434111
parent
434a6c85
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
19 deletions
+24
-19
src/cmd/gc/go.y
src/cmd/gc/go.y
+23
-18
src/cmd/gc/typecheck.c
src/cmd/gc/typecheck.c
+1
-1
No files found.
src/cmd/gc/go.y
View file @
7a42dddb
...
...
@@ -66,7 +66,7 @@ static void fixlbrace(int);
%type <node> pseudocall range_stmt select_stmt
%type <node> simple_stmt
%type <node> switch_stmt uexpr
%type <node> xfndcl typedcl
%type <node> xfndcl typedcl
start_complit
%type <list> xdcl fnbody fnres loop_body dcl_name_list
%type <list> new_name_list expr_list keyval_list braced_keyval_list expr_or_type_list xdcl_list
...
...
@@ -900,29 +900,34 @@ pexpr_no_paren:
$$
=
nod
(
OCALL
,
$
1
,
N
);
$$->
list
=
list1
($
3
);
}
|
comptype
lbrace
braced_keyval_list
'}'
|
comptype
lbrace
start_complit
braced_keyval_list
'}'
{
//
composite
expression
$$
=
nod
(
OCOMPLIT
,
N
,
$
1
);
$$->
list
=
$
3
;
$$
=
$
3
;
$$->
right
=
$
1
;
$$->
list
=
$
4
;
fixlbrace
($
2
);
}
|
pexpr_no_paren
'{'
braced_keyval_list
'}'
|
pexpr_no_paren
'{'
start_complit
braced_keyval_list
'}'
{
//
composite
expression
$$
=
nod
(
OCOMPLIT
,
N
,
$
1
)
;
$$->
list
=
$
3
;
$$
=
$
3
;
$$
->
right
=
$
1
;
$$->
list
=
$
4
;
}
|
'('
expr_or_type
')'
'{'
braced_keyval_list
'}'
|
'('
expr_or_type
')'
'{'
start_complit
braced_keyval_list
'}'
{
yyerror
(
"cannot parenthesize type in composite literal"
);
//
composite
expression
$$
=
nod
(
OCOMPLIT
,
N
,
$
2
);
$$->
list
=
$
5
;
$$
=
$
5
;
$$->
right
=
$
2
;
$$->
list
=
$
6
;
}
|
fnliteral
start_complit
:
{
//
composite
expression
.
//
make
node
early
so
we
get
the
right
line
number
.
$$
=
nod
(
OCOMPLIT
,
N
,
N
);
}
keyval
:
expr
':'
complitexpr
{
...
...
@@ -931,10 +936,10 @@ keyval:
complitexpr
:
expr
|
'{'
braced_keyval_list
'}'
|
'{'
start_complit
braced_keyval_list
'}'
{
$$
=
nod
(
OCOMPLIT
,
N
,
N
)
;
$$->
list
=
$
2
;
$$
=
$
2
;
$$->
list
=
$
3
;
}
pexpr
:
...
...
src/cmd/gc/typecheck.c
View file @
7a42dddb
...
...
@@ -1994,7 +1994,7 @@ pushtype(Node *n, Type *t)
else
if
(
debug
[
's'
])
{
typecheck
(
&
n
->
right
,
Etype
);
if
(
n
->
right
->
type
!=
T
&&
eqtype
(
n
->
right
->
type
,
t
))
print
(
"%lL: redundant type: %T
\n
"
,
n
->
right
->
lineno
,
t
);
print
(
"%lL: redundant type: %T
\n
"
,
n
->
lineno
,
t
);
}
}
...
...
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