test_errors.go | calc.go | method1.go | selftest1.go | func3.go | const2.go | \
bug014.go | bug025.go | bug029.go | bug032.go | bug039.go | bug040.go | bug050.go | bug068.go | \
bug088.go | bug083.go | bug106.go | bug121.go | bug125.go | bug126.go | bug132.go | bug133.go | \
- bug134.go | bug160.go | bug166.go ) ;;
+ bug134.go | bug160.go | bug163.go | bug166.go ) ;;
* ) $1 $2; count $F;;
esac
}
}
+// isExportedType assumes that typ is a correct type.
+func isExportedType(typ Expr) bool {
+ switch t := typ.(type) {
+ case *Ident:
+ return t.IsExported();
+ case *ParenExpr:
+ return isExportedType(t.X);
+ case *SelectorExpr:
+ // assume t.X is a typename
+ return t.Sel.IsExported();
+ case *StarExpr:
+ return isExportedType(t.X);
+ }
+ return false;
+}
+
+
func filterType(typ Expr)
func filterFieldList(list []*Field) []*Field {
exported := false;
if len(f.Names) == 0 {
// anonymous field
- // TODO(gri) check if the type is exported for anonymous field
- exported = true;
+ // (Note that a non-exported anonymous field
+ // may still refer to a type with exported
+ // fields, so this is not absolutely correct.
+ // However, this cannot be done w/o complete
+ // type information.)
+ exported = isExportedType(f.Type);
} else {
f.Names = filterIdentList(f.Names);
exported = len(f.Names) > 0;
// TODO Consider different approach to checking syntax after parsing:
// Provide a arguments (set of flags) to parsing functions
-// restricting what they are syupposed to accept depending
+// restricting what they are supposed to accept depending
// on context.
// checkExpr checks that x is an expression (and not a type).