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
bd77eeda
Commit
bd77eeda
authored
Apr 14, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: fix use of typekind array in error messages
Fixes #1697. R=ken2 CC=golang-dev
https://golang.org/cl/4395045
parent
dd93df35
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
src/cmd/gc/typecheck.c
src/cmd/gc/typecheck.c
+16
-2
No files found.
src/cmd/gc/typecheck.c
View file @
bd77eeda
...
...
@@ -56,7 +56,7 @@ typechecklist(NodeList *l, int top)
typecheck
(
&
l
->
n
,
top
);
}
static
char
*
typekind
[]
=
{
static
char
*
_
typekind
[]
=
{
[
TINT
]
=
"int"
,
[
TUINT
]
=
"uint"
,
[
TINT8
]
=
"int8"
,
...
...
@@ -82,8 +82,22 @@ static char* typekind[] = {
[
TMAP
]
=
"map"
,
[
TARRAY
]
=
"array"
,
[
TFUNC
]
=
"func"
,
[
TNIL
]
=
"nil"
,
[
TIDEAL
]
=
"ideal number"
,
};
static
char
*
typekind
(
int
et
)
{
static
char
buf
[
50
];
char
*
s
;
if
(
0
<=
et
&&
et
<
nelem
(
_typekind
)
&&
(
s
=
_typekind
[
et
])
!=
nil
)
return
s
;
snprint
(
buf
,
sizeof
buf
,
"etype=%d"
,
et
);
return
buf
;
}
/*
* type check node *np.
* replaces *np with a new pointer in some cases.
...
...
@@ -406,7 +420,7 @@ reswitch:
}
if
(
!
okfor
[
op
][
et
])
{
notokfor:
yyerror
(
"invalid operation: %#N (operator %#O not defined on %s)"
,
n
,
op
,
typekind
[
et
]
);
yyerror
(
"invalid operation: %#N (operator %#O not defined on %s)"
,
n
,
op
,
typekind
(
et
)
);
goto
error
;
}
// okfor allows any array == array;
...
...
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