Commit adda7ad2 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile/internal/gc: enable new parser by default

Change-Id: I3c784986755cfbbe1b8eb8da4d64227bd109a3b0
Reviewed-on: https://go-review.googlesource.com/27203
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
parent 263a825b
...@@ -181,7 +181,7 @@ func Main() { ...@@ -181,7 +181,7 @@ func Main() {
obj.Flagcount("live", "debug liveness analysis", &debuglive) obj.Flagcount("live", "debug liveness analysis", &debuglive)
obj.Flagcount("m", "print optimization decisions", &Debug['m']) obj.Flagcount("m", "print optimization decisions", &Debug['m'])
flag.BoolVar(&flag_msan, "msan", false, "build code compatible with C/C++ memory sanitizer") flag.BoolVar(&flag_msan, "msan", false, "build code compatible with C/C++ memory sanitizer")
flag.BoolVar(&flag_newparser, "newparser", false, "use new parser") flag.BoolVar(&flag_newparser, "newparser", true, "use new parser")
flag.BoolVar(&nolocalimports, "nolocalimports", false, "reject local (relative) imports") flag.BoolVar(&nolocalimports, "nolocalimports", false, "reject local (relative) imports")
flag.StringVar(&outfile, "o", "", "write output to `file`") flag.StringVar(&outfile, "o", "", "write output to `file`")
flag.StringVar(&myimportpath, "p", "", "set expected package import `path`") flag.StringVar(&myimportpath, "p", "", "set expected package import `path`")
......
...@@ -578,6 +578,7 @@ func (p *noder) structType(expr *syntax.StructType) *Node { ...@@ -578,6 +578,7 @@ func (p *noder) structType(expr *syntax.StructType) *Node {
l = append(l, n) l = append(l, n)
} }
p.lineno(expr)
n := p.nod(expr, OTSTRUCT, nil, nil) n := p.nod(expr, OTSTRUCT, nil, nil)
n.List.Set(l) n.List.Set(l)
return n return n
......
...@@ -100,9 +100,7 @@ func testTestDir(t *testing.T, path string, ignore ...string) { ...@@ -100,9 +100,7 @@ func testTestDir(t *testing.T, path string, ignore ...string) {
switch cmd { switch cmd {
case "skip", "compiledir": case "skip", "compiledir":
continue // ignore this file continue // ignore this file
// TODO(mdempsky): Remove -newparser=0 case once case "errorcheck":
// test/fixedbugs/issue11610.go is updated.
case "errorcheck", "errorcheck -newparser=0":
expectErrors = true expectErrors = true
} }
} }
......
// errorcheck -newparser=1 // errorcheck
// Copyright 2016 The Go Authors. All rights reserved. // Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
......
// errorcheck -newparser=0 // errorcheck
// Copyright 2015 The Go Authors. All rights reserved. // Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
...@@ -7,15 +7,11 @@ ...@@ -7,15 +7,11 @@
// Test an internal compiler error on ? symbol in declaration // Test an internal compiler error on ? symbol in declaration
// following an empty import. // following an empty import.
// TODO(mdempsky): Update for new parser. New parser recovers more
// gracefully and doesn't trigger the "cannot declare name" error.
// Also remove "errorcheck -newparser=0" case in go/types.TestStdFixed.
package a package a
import"" // ERROR "import path is empty" import"" // ERROR "import path is empty"
var? // ERROR "illegal character U\+003F '\?'" var? // ERROR "illegal character U\+003F '\?'"
var x int // ERROR "unexpected var" "cannot declare name" var x int // ERROR "unexpected var"
func main() { func main() {
} }
// errorcheckoutput -newparser=0 // errorcheckoutput
// Copyright 2009 The Go Authors. All rights reserved. // Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
...@@ -6,10 +6,6 @@ ...@@ -6,10 +6,6 @@
// Test source files and strings containing NUL and invalid UTF-8. // Test source files and strings containing NUL and invalid UTF-8.
// TODO(mdempsky): Update error expectations for -newparser=1. The new
// lexer skips over NUL and invalid UTF-8 sequences, so they don't emit
// "illegal character" or "invalid identifier character" errors.
package main package main
import ( import (
...@@ -40,7 +36,7 @@ var y = ` + "`in raw string \x00 foo`" + ` // ERROR "NUL" ...@@ -40,7 +36,7 @@ var y = ` + "`in raw string \x00 foo`" + ` // ERROR "NUL"
/* in other comment ` + "\x00" + ` */ // ERROR "NUL" /* in other comment ` + "\x00" + ` */ // ERROR "NUL"
/* in source code */ ` + "\x00" + `// ERROR "NUL" "illegal character" /* in source code */ ` + "\x00" + `// ERROR "NUL"
var xx = "in string ` + "\xc2\xff" + `" // ERROR "UTF-8" var xx = "in string ` + "\xc2\xff" + `" // ERROR "UTF-8"
...@@ -51,9 +47,9 @@ var yy = ` + "`in raw string \xff foo`" + ` // ERROR "UTF-8" ...@@ -51,9 +47,9 @@ var yy = ` + "`in raw string \xff foo`" + ` // ERROR "UTF-8"
/* in other comment ` + "\xe0\x00\x00" + ` */ // ERROR "UTF-8|NUL" /* in other comment ` + "\xe0\x00\x00" + ` */ // ERROR "UTF-8|NUL"
/* in variable name */ /* in variable name */
var z` + "\xc1\x81" + ` int // ERROR "UTF-8" "invalid identifier character" var z` + "\xc1\x81" + ` int // ERROR "UTF-8"
/* in source code */ ` + "var \xc2A int" + `// ERROR "UTF-8" "invalid identifier character" /* in source code */ ` + "var \xc2A int" + `// ERROR "UTF-8"
`) `)
} }
// errorcheck -newparser=0 // errorcheck
// Copyright 2010 The Go Authors. All rights reserved. // Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// TODO(mdempsky): Update for new parser or delete.
// Like go/parser, the new parser doesn't specially recognize
// send statements misused in an expression context.
package main package main
var c chan int var c chan int
var v int var v int
func main() { func main() {
if c <- v { // ERROR "used as value" if c <- v { // ERROR "used as value|missing condition|invalid condition"
} }
} }
var _ = c <- v // ERROR "used as value" var _ = c <- v // ERROR "used as value|unexpected <-"
// errorcheck -newparser=0 // errorcheck
// Copyright 2010 The Go Authors. All rights reserved. // Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
...@@ -14,4 +14,4 @@ package main ...@@ -14,4 +14,4 @@ package main
func main() { func main() {
for x // GCCGO_ERROR "undefined" for x // GCCGO_ERROR "undefined"
{ // ERROR "missing .*{.* after for clause|missing operand" { // ERROR "missing .*{.* after for clause|missing operand"
z // GCCGO_ERROR "undefined" z // ERROR "undefined|missing { after for clause"
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