mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: remove dead code handling '~' operator
The parser code was not reachable ever since some of the lexer cleanups. We could recognize '~' in the lexer, complain, and return a '^' instead, but it's been a few years since Go was new and this may have been a use- ful error. The lexer complains with "illegal character U+007E '~'" which is good enough. For #13244. Change-Id: Ie3283738486eb6f8462d594f2728ac98333c0520 Reviewed-on: https://go-review.googlesource.com/20768 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
8540a1c4df
commit
c1a4fe8d57
1 changed files with 1 additions and 8 deletions
|
|
@ -1161,13 +1161,6 @@ func (p *parser) uexpr() *Node {
|
||||||
case '!':
|
case '!':
|
||||||
op = ONOT
|
op = ONOT
|
||||||
|
|
||||||
case '~':
|
|
||||||
// TODO(gri) do this in the lexer instead (issue 13244)
|
|
||||||
p.next()
|
|
||||||
x := p.uexpr()
|
|
||||||
Yyerror("the bitwise complement operator is ^")
|
|
||||||
return Nod(OCOM, x, nil)
|
|
||||||
|
|
||||||
case '^':
|
case '^':
|
||||||
op = OCOM
|
op = OCOM
|
||||||
|
|
||||||
|
|
@ -2517,7 +2510,7 @@ func (p *parser) stmt() *Node {
|
||||||
|
|
||||||
case LNAME, '@', '?', LLITERAL, LFUNC, '(', // operands
|
case LNAME, '@', '?', LLITERAL, LFUNC, '(', // operands
|
||||||
'[', LSTRUCT, LMAP, LCHAN, LINTERFACE, // composite types
|
'[', LSTRUCT, LMAP, LCHAN, LINTERFACE, // composite types
|
||||||
'+', '-', '*', '&', '^', '~', LCOMM, '!': // unary operators
|
'+', '-', '*', '&', '^', LCOMM, '!': // unary operators
|
||||||
return p.simple_stmt(true, false)
|
return p.simple_stmt(true, false)
|
||||||
|
|
||||||
case LFOR:
|
case LFOR:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue