aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/parser.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/syntax/parser.go')
-rw-r--r--src/cmd/compile/internal/syntax/parser.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/syntax/parser.go b/src/cmd/compile/internal/syntax/parser.go
index 6419998ff1..903a89c2ff 100644
--- a/src/cmd/compile/internal/syntax/parser.go
+++ b/src/cmd/compile/internal/syntax/parser.go
@@ -1367,8 +1367,9 @@ func (p *parser) paramList() (list []*Field) {
// ----------------------------------------------------------------------------
// Statements
-// We represent x++, x-- as assignments x += one, x -= one.
-var one = &BasicLit{Value: "1"}
+// We represent x++, x-- as assignments x += ImplicitOne, x -= ImplicitOne.
+// ImplicitOne should not be used elsewhere.
+var ImplicitOne = &BasicLit{Value: "1"}
// SimpleStmt = EmptyStmt | ExpressionStmt | SendStmt | IncDecStmt | Assignment | ShortVarDecl .
//
@@ -1403,7 +1404,7 @@ func (p *parser) simpleStmt(lhs Expr, rangeOk bool) SimpleStmt {
// lhs++ or lhs--
op := p.op
p.next()
- return p.newAssignStmt(op, lhs, one)
+ return p.newAssignStmt(op, lhs, ImplicitOne)
case _Arrow:
// lhs <- rhs