]> Cypherpunks repositories - gostls13.git/commitdiff
- renamed hasPostfix -> hasSuffix
authorRobert Griesemer <gri@golang.org>
Fri, 3 Apr 2009 05:24:52 +0000 (22:24 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 3 Apr 2009 05:24:52 +0000 (22:24 -0700)
- fixed printing of function literals (require separating ";")

R=rsc
OCL=27055
CL=27055

usr/gri/pretty/astprinter.go
usr/gri/pretty/godoc.go

index 5164495fe780abc9a4c5069ed49251c2fb46c9e6..66fc3616f461b8b012376ae2df2f8de244e623f9 100644 (file)
@@ -658,6 +658,7 @@ func (P *Printer) DoFuncLit(x *ast.FuncLit) {
        P.DoFuncType(x.Type);
        P.separator = blank;
        P.Stmt(x.Body);
+       P.opt_semi = false;  // BUG 6g or spec
        P.newlines = 0;
 }
 
index 947b42cdaad40a8eb693b0747775840e148f1a1e..8b428d38f05bc685eb9789a6246aace969f68331 100644 (file)
@@ -100,14 +100,14 @@ func hasPrefix(s, prefix string) bool {
 }
 
 
-func hasPostfix(s, postfix string) bool {
+func hasSuffix(s, postfix string) bool {
        pos := len(s) - len(postfix);
        return pos >= 0 && s[pos : len(s)] == postfix;
 }
 
 
 func isGoFile(dir *os.Dir) bool {
-       return dir.IsRegular() && hasPostfix(dir.Name, ".go");
+       return dir.IsRegular() && hasSuffix(dir.Name, ".go");
 }
 
 
@@ -414,7 +414,7 @@ var (
 
 
 func addFile(dirname string, filename string) {
-       if hasPostfix(filename, "_test.go") {
+       if hasSuffix(filename, "_test.go") {
                // ignore package tests
                return;
        }