]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: resolve TODO of Mpflt.SetString
authorCholerae Hu <choleraehyq@gmail.com>
Tue, 29 Oct 2019 05:50:31 +0000 (13:50 +0800)
committerRobert Griesemer <gri@golang.org>
Wed, 30 Oct 2019 04:55:05 +0000 (04:55 +0000)
Number literal strings returned by the lexer (internal/syntax package) and other
arguments to SetString never contain leading whitespace. There's no need (anymore)
to trim the argument.

Change-Id: Ib060d109f46f79a364a5c8aa33c4f625fe849264
Reviewed-on: https://go-review.googlesource.com/c/go/+/203997
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/mpfloat.go

index d15f26784edd0a6157430bc2fc2aa9150daee3cd..401aef319de7ccc58a2a5d8b3188dade255233d5 100644 (file)
@@ -179,11 +179,6 @@ func (a *Mpflt) Neg() {
 }
 
 func (a *Mpflt) SetString(as string) {
-       // TODO(gri) why is this needed?
-       for len(as) > 0 && (as[0] == ' ' || as[0] == '\t') {
-               as = as[1:]
-       }
-
        f, _, err := a.Val.Parse(as, 0)
        if err != nil {
                yyerror("malformed constant: %s (%v)", as, err)