sep = blank;
}
for i, f := range list {
+ var ml bool;
extraTabs := 0;
p.leadComment(f.Doc);
if len(f.Names) > 0 {
- p.identList(f.Names, ignoreMultiLine);
+ p.identList(f.Names, &ml);
p.print(sep);
- p.expr(f.Type, ignoreMultiLine);
+ p.expr(f.Type, &ml);
extraTabs = 1;
} else {
- p.expr(f.Type, ignoreMultiLine);
+ p.expr(f.Type, &ml);
extraTabs = 2;
}
if f.Tag != nil {
p.print(sep);
}
p.print(sep);
- p.expr(&ast.StringList{f.Tag}, ignoreMultiLine);
+ p.expr(&ast.StringList{f.Tag}, &ml);
extraTabs = 0;
}
p.print(token.SEMICOLON);
}
p.lineComment(f.Comment);
}
- if i+1 < len(list) || isIncomplete {
- p.print(newline);
+ if i+1 < len(list) {
+ p.linebreak(list[i+1].Pos().Line, 1, 2, ignore, ml);
+ } else if isIncomplete {
+ p.print(formfeed);
}
}
if isIncomplete {
} else { // interface
for i, f := range list {
+ var ml bool;
p.leadComment(f.Doc);
if ftyp, isFtyp := f.Type.(*ast.FuncType); isFtyp {
// method
- p.expr(f.Names[0], ignoreMultiLine); // exactly one name
- p.signature(ftyp.Params, ftyp.Results, ignoreMultiLine);
+ p.expr(f.Names[0], &ml);
+ p.signature(ftyp.Params, ftyp.Results, &ml);
} else {
// embedded interface
- p.expr(f.Type, ignoreMultiLine);
+ p.expr(f.Type, &ml);
}
p.print(token.SEMICOLON);
p.lineComment(f.Comment);
- if i+1 < len(list) || isIncomplete {
- p.print(newline);
+ if i+1 < len(list) {
+ p.linebreak(list[i+1].Pos().Line, 1, 2, ignore, ml);
+ } else if isIncomplete {
+ p.print(formfeed);
}
}
if isIncomplete {
}
+// don't lose blank lines in this struct
+type _ struct {
+ String struct {
+ Str, Len int;
+ };
+ Slice struct {
+ Array, Len, Cap int;
+ };
+ Eface struct {
+ Typ, Ptr int;
+ };
+
+ UncommonType struct {
+ Name, PkgPath int;
+ };
+ CommonType struct {
+ Size, Hash, Alg, Align, FieldAlign, String, UncommonType int;
+ };
+ Type struct {
+ Typ, Ptr int;
+ };
+ StructField struct {
+ Name, PkgPath, Typ, Tag, Offset int;
+ };
+ StructType struct {
+ Fields int;
+ };
+ PtrType struct {
+ Elem int;
+ };
+ SliceType struct {
+ Elem int;
+ };
+ ArrayType struct {
+ Elem, Len int;
+ };
+
+ Stktop struct {
+ Stackguard, Stackbase, Gobuf int;
+ };
+ Gobuf struct {
+ Sp, Pc, G int;
+ };
+ G struct {
+ Stackbase, Sched, Status, Alllink int;
+ };
+}
// no tabs for single or ungrouped decls
}
+// don't lose blank lines in this struct
+type _ struct {
+ String struct {
+ Str, Len int;
+ };
+ Slice struct {
+ Array, Len, Cap int;
+ };
+ Eface struct {
+ Typ, Ptr int;
+ };
+
+ UncommonType struct {
+ Name, PkgPath int;
+ };
+ CommonType struct {
+ Size, Hash, Alg, Align, FieldAlign, String, UncommonType int;
+ };
+ Type struct {
+ Typ, Ptr int;
+ };
+ StructField struct {
+ Name, PkgPath, Typ, Tag, Offset int;
+ };
+ StructType struct {
+ Fields int;
+ };
+ PtrType struct {
+ Elem int;
+ };
+ SliceType struct {
+ Elem int;
+ };
+ ArrayType struct {
+ Elem, Len int;
+ };
+
+ Stktop struct {
+ Stackguard, Stackbase, Gobuf int;
+ };
+ Gobuf struct {
+ Sp, Pc, G int;
+ };
+ G struct {
+ Stackbase, Sched, Status, Alllink int;
+ };
+}
+
+
// no tabs for single or ungrouped decls
func _() {
const xxxxxx = 0;