drop old generation mechanisms that were already deprecated.
@@ -135,71 +135,6 @@ func Generate(pth string, pkgName string, ts schema.TypeSystem, adjCfg *AdjunctC
})
}
-// GenerateSplayed is like Generate, but emits a differnet pattern of files.
-// GenerateSplayed emits many more individual files than Generate.
-//
-// This function should be considered deprecated and may be removed in the future.
-func GenerateSplayed(pth string, pkgName string, ts schema.TypeSystem, adjCfg *AdjunctCfg) {
- // Emit fixed bits.
- withFile(filepath.Join(pth, "minima.go"), func(f io.Writer) {
- EmitInternalEnums(pkgName, f)
- })
-
- // Emit a file for each type.
- for _, typ := range ts.GetTypes() {
- withFile(filepath.Join(pth, "t"+typ.Name().String()+".go"), func(f io.Writer) {
- EmitFileHeader(pkgName, f)
- switch t2 := typ.(type) {
- case *schema.TypeBool:
- EmitEntireType(NewBoolReprBoolGenerator(pkgName, t2, adjCfg), f)
- case *schema.TypeInt:
- EmitEntireType(NewIntReprIntGenerator(pkgName, t2, adjCfg), f)
- case *schema.TypeFloat:
- EmitEntireType(NewFloatReprFloatGenerator(pkgName, t2, adjCfg), f)
- case *schema.TypeString:
- EmitEntireType(NewStringReprStringGenerator(pkgName, t2, adjCfg), f)
- case *schema.TypeBytes:
- EmitEntireType(NewBytesReprBytesGenerator(pkgName, t2, adjCfg), f)
- case *schema.TypeLink:
- EmitEntireType(NewLinkReprLinkGenerator(pkgName, t2, adjCfg), f)
- case *schema.TypeStruct:
- switch t2.RepresentationStrategy().(type) {
- case schema.StructRepresentation_Map:
- EmitEntireType(NewStructReprMapGenerator(pkgName, t2, adjCfg), f)
- case schema.StructRepresentation_Tuple:
- EmitEntireType(NewStructReprTupleGenerator(pkgName, t2, adjCfg), f)
- case schema.StructRepresentation_Stringjoin:
- EmitEntireType(NewStructReprStringjoinGenerator(pkgName, t2, adjCfg), f)
- default:
- panic("unrecognized struct representation strategy")
- }
- case *schema.TypeMap:
- EmitEntireType(NewMapReprMapGenerator(pkgName, t2, adjCfg), f)
- case *schema.TypeList:
- EmitEntireType(NewListReprListGenerator(pkgName, t2, adjCfg), f)
- case *schema.TypeUnion:
- switch t2.RepresentationStrategy().(type) {
- case schema.UnionRepresentation_Keyed:
- EmitEntireType(NewUnionReprKeyedGenerator(pkgName, t2, adjCfg), f)
- case schema.UnionRepresentation_Kinded:
- EmitEntireType(NewUnionKindedGenerator(pkgName, t2, adjCfg), f)
- default:
- panic("unrecognized union representation strategy")
- }
- default:
- panic("add more type switches here :)")
- }
- })
- }
-
- // Emit the unified type table.
- withFile(filepath.Join(pth, "typeTable.go"), func(f io.Writer) {
- fmt.Fprintf(f, "package %s\n\n", pkgName)
- fmt.Fprintf(f, doNotEditComment+"\n\n")
- EmitTypeTable(pkgName, ts, adjCfg, f)
- })
-}
-
func withFile(filename string, fn func(io.Writer)) {
f, err := os.OpenFile(filename, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
if err != nil {
