]> Cypherpunks repositories - gostls13.git/commitdiff
- oversight: extra allow source-level line breaks inside statement lists
authorRobert Griesemer <gri@golang.org>
Wed, 3 Dec 2008 01:01:31 +0000 (17:01 -0800)
committerRobert Griesemer <gri@golang.org>
Wed, 3 Dec 2008 01:01:31 +0000 (17:01 -0800)
- fixed printing of empty structs/interfaces
- enable two more tests

R=r
OCL=20296
CL=20296

usr/gri/pretty/printer.go
usr/gri/pretty/selftest2.go
usr/gri/pretty/test.sh

index f1da8c3d3916bc77f8860749ca7a1754c620c479..29c65e2b1edabf7f9c62c05bf9bbe56a943924b0 100644 (file)
@@ -348,7 +348,7 @@ func (P *Printer) Fields(list *array.Array, end int) {
        P.state = opening_scope;
        P.String(0, "{");
 
-       if list != nil {
+       if list.Len() > 0 {
                P.newlines = 1;
                var prev int;
                for i, n := 0, list.Len(); i < n; i++ {
@@ -547,6 +547,7 @@ func (P *Printer) StatementList(list *array.Array) {
                for i, n := 0, list.Len(); i < n; i++ {
                        P.Stat(list.At(i).(*AST.Stat));
                        P.newlines = 1;
+                       P.state = inside_list;
                }
        }
 }
index 3062399329b05481f6d702e28f5c54809a516bc6..eb7dcb2e2f1bd9d203a26717dceb21db074e3af0 100644 (file)
@@ -25,6 +25,9 @@ const /* enum */ (
 )
 
 
+type S struct {}
+
+
 type T struct {
        x, y int;
        s string;
index 4840778d5febb00c136d3ac5b6da50cc03079a98..3b8d6e6871ea0e213e5e82f9f79522c58c0d38dd 100755 (executable)
@@ -23,7 +23,7 @@ apply1() {
        #echo $1 $2
        case `basename $F` in
        # these files don't pass the idempotency test yet
-       log.go | decimal.go | type.go | tabwriter_test.go | \
+       log.go | type.go | \
        \
        selftest1.go | func3.go | bug014.go | bug029.go | bug032.go | bug050.go | \
        bug068.go | bug088.go | bug083.go | bug106.go | bug125.go ) ;;  # skip - files contain syntax errors