Commit c1a4fe8d authored by Robert Griesemer's avatar Robert Griesemer

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/20768Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent 8540a1c4
......@@ -1161,13 +1161,6 @@ func (p *parser) uexpr() *Node {
case '!':
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 '^':
op = OCOM
......@@ -2517,7 +2510,7 @@ func (p *parser) stmt() *Node {
case LNAME, '@', '?', LLITERAL, LFUNC, '(', // operands
'[', LSTRUCT, LMAP, LCHAN, LINTERFACE, // composite types
'+', '-', '*', '&', '^', '~', LCOMM, '!': // unary operators
'+', '-', '*', '&', '^', LCOMM, '!': // unary operators
return p.simple_stmt(true, false)
case LFOR:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment