]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove dead code handling '~' operator
authorRobert Griesemer <gri@golang.org>
Wed, 16 Mar 2016 21:02:56 +0000 (14:02 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 16 Mar 2016 21:39:49 +0000 (21:39 +0000)
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>
src/cmd/compile/internal/gc/parser.go

index 4813cab6ded2a5abff81dafda664b796705f3a0f..4288570fbc1cf253c8aaca26b2c301b7b611bd8b 100644 (file)
@@ -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: