summaryrefslogtreecommitdiff
path: root/src/pkg
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2010-06-08 17:46:04 -0700
committerRobert Griesemer <gri@golang.org>2010-06-08 17:46:04 -0700
commite577f85b2d2908bc727a91a7a5b9f79367f3d48c (patch)
tree46fbcf021e6ce058db4fc2c0cb0217a95b46cb8b /src/pkg
parentb5d90f129ff05994a075ce637ff56e1a2f6594b7 (diff)
downloadgolang-e577f85b2d2908bc727a91a7a5b9f79367f3d48c.tar.gz
go/printer: deleted dead code
(remains of the semicolon conversion) R=rsc CC=golang-dev http://codereview.appspot.com/1623041
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/go/printer/nodes.go33
-rw-r--r--src/pkg/go/printer/printer.go4
2 files changed, 14 insertions, 23 deletions
diff --git a/src/pkg/go/printer/nodes.go b/src/pkg/go/printer/nodes.go
index a48a40790..a98af4a2a 100644
--- a/src/pkg/go/printer/nodes.go
+++ b/src/pkg/go/printer/nodes.go
@@ -1021,7 +1021,7 @@ func (p *printer) stmt(stmt ast.Stmt, nextIsRBrace bool, multiLine *bool) {
p.print("BadStmt")
case *ast.DeclStmt:
- p.decl(s.Decl, inStmtList, multiLine)
+ p.decl(s.Decl, multiLine)
case *ast.EmptyStmt:
// nothing to do
@@ -1191,21 +1191,12 @@ func (p *printer) stmt(stmt ast.Stmt, nextIsRBrace bool, multiLine *bool) {
// ----------------------------------------------------------------------------
// Declarations
-type declContext uint
-
-const (
- atTop declContext = iota
- inGroup
- inStmtList
-)
-
-// The parameter n is the number of specs in the group; context specifies
-// the surroundings of the declaration. Separating semicolons are printed
-// depending on the context. If indent is set, a multi-line identifier lists
-// in the spec are indented when the first linebreak is encountered. Sets
-// multiLine to true if the spec spans multiple lines.
+// The parameter n is the number of specs in the group. If indent is set,
+// multi-line identifier lists in the spec are indented when the first
+// linebreak is encountered.
+// Sets multiLine to true if the spec spans multiple lines.
//
-func (p *printer) spec(spec ast.Spec, n int, context declContext, indent bool, multiLine *bool) {
+func (p *printer) spec(spec ast.Spec, n int, indent bool, multiLine *bool) {
switch s := spec.(type) {
case *ast.ImportSpec:
p.setComment(s.Doc)
@@ -1268,7 +1259,7 @@ func (p *printer) spec(spec ast.Spec, n int, context declContext, indent bool, m
// Sets multiLine to true if the declaration spans multiple lines.
-func (p *printer) genDecl(d *ast.GenDecl, context declContext, multiLine *bool) {
+func (p *printer) genDecl(d *ast.GenDecl, multiLine *bool) {
p.setComment(d.Doc)
p.print(d.Pos(), d.Tok, blank)
@@ -1283,7 +1274,7 @@ func (p *printer) genDecl(d *ast.GenDecl, context declContext, multiLine *bool)
p.linebreak(s.Pos().Line, 1, 2, ignore, ml)
}
ml = false
- p.spec(s, len(d.Specs), inGroup, false, &ml)
+ p.spec(s, len(d.Specs), false, &ml)
}
p.print(unindent, formfeed)
*multiLine = true
@@ -1292,7 +1283,7 @@ func (p *printer) genDecl(d *ast.GenDecl, context declContext, multiLine *bool)
} else {
// single declaration
- p.spec(d.Specs[0], 1, context, true, multiLine)
+ p.spec(d.Specs[0], 1, true, multiLine)
}
}
@@ -1406,12 +1397,12 @@ func (p *printer) funcDecl(d *ast.FuncDecl, multiLine *bool) {
// Sets multiLine to true if the declaration spans multiple lines.
-func (p *printer) decl(decl ast.Decl, context declContext, multiLine *bool) {
+func (p *printer) decl(decl ast.Decl, multiLine *bool) {
switch d := decl.(type) {
case *ast.BadDecl:
p.print(d.Pos(), "BadDecl")
case *ast.GenDecl:
- p.genDecl(d, context, multiLine)
+ p.genDecl(d, multiLine)
case *ast.FuncDecl:
p.funcDecl(d, multiLine)
default:
@@ -1454,7 +1445,7 @@ func (p *printer) file(src *ast.File) {
min = 2
}
p.linebreak(d.Pos().Line, min, maxDeclNewlines, ignore, false)
- p.decl(d, atTop, ignoreMultiLine)
+ p.decl(d, ignoreMultiLine)
}
}
diff --git a/src/pkg/go/printer/printer.go b/src/pkg/go/printer/printer.go
index 9bb6564a5..53632c83d 100644
--- a/src/pkg/go/printer/printer.go
+++ b/src/pkg/go/printer/printer.go
@@ -1016,10 +1016,10 @@ func (cfg *Config) Fprint(output io.Writer, node interface{}) (int, os.Error) {
p.stmt(n, false, ignoreMultiLine)
case ast.Decl:
p.useNodeComments = true
- p.decl(n, atTop, ignoreMultiLine)
+ p.decl(n, ignoreMultiLine)
case ast.Spec:
p.useNodeComments = true
- p.spec(n, 1, atTop, false, ignoreMultiLine)
+ p.spec(n, 1, false, ignoreMultiLine)
case *ast.File:
p.comments = n.Comments
p.useNodeComments = n.Comments == nil