func makePlatformStringsExpr(ps platformStringsExprs) bzl.Expr {
	makeSelect := func(dict *bzl.DictExpr) bzl.Expr {
		return &bzl.CallExpr{
			X:    &bzl.Ident{Name: "select"},
			List: []bzl.Expr{dict},
		}
	}
	forceMultiline := func(e bzl.Expr) {
		switch e := e.(type) {
		case *bzl.ListExpr:
			e.ForceMultiLine = true
		case *bzl.CallExpr:
			e.List[0].(*bzl.DictExpr).ForceMultiLine = true
		}
	}

	var parts []bzl.Expr
	if ps.generic != nil {
		parts = append(parts, ps.generic)
	}
	if ps.os != nil {
		parts = append(parts, makeSelect(ps.os))
	}
	if ps.arch != nil {
		parts = append(parts, makeSelect(ps.arch))
	}
	if ps.platform != nil {
		parts = append(parts, makeSelect(ps.platform))
	}

	if len(parts) == 0 {
		return nil
	}
	if len(parts) == 1 {
		return parts[0]
	}
	expr := parts[0]
	forceMultiline(expr)
	for _, part := range parts[1:] {
		forceMultiline(part)
		expr = &bzl.BinaryExpr{
			Op: "+",
			X:  expr,
			Y:  part,
		}
	}
	return expr
}
func makePlatformStringsExpr(ps platformStringsExprs) bzl.Expr {
	makeSelect := func(dict *bzl.DictExpr) bzl.Expr {
		return &bzl.CallExpr{
			X:    &bzl.Ident{Name: "select"},
			List: []bzl.Expr{dict},
		}
	}
	forceMultiline := func(e bzl.Expr) {
		switch e := e.(type) {
		case *bzl.ListExpr:
			e.ForceMultiLine = true
		case *bzl.CallExpr:
			e.List[0].(*bzl.DictExpr).ForceMultiLine = true
		}
	}

	var parts []bzl.Expr
	if ps.generic != nil {
		parts = append(parts, ps.generic)
	}
	if ps.os != nil {
		parts = append(parts, makeSelect(ps.os))
	}
	if ps.arch != nil {
		parts = append(parts, makeSelect(ps.arch))
	}
	if ps.platform != nil {
		parts = append(parts, makeSelect(ps.platform))
	}

	if len(parts) == 0 {
		return nil
	}
	if len(parts) == 1 {
		return parts[0]
	}
	expr := parts[0]
	forceMultiline(expr)
	for _, part := range parts[1:] {
		forceMultiline(part)
		expr = &bzl.BinaryExpr{
			Op: "+",
			X:  expr,
			Y:  part,
		}
	}
	return expr
}
func makePlatformStringsExpr ( ps platformStringsExprs ) bzl . Expr { makeSelect := func ( dict * bzl . DictExpr ) bzl . Expr { return & bzl . CallExpr { X : & bzl . Ident { Name : " " } , List : [ ] bzl . Expr { dict } , } } forceMultiline := func ( e bzl . Expr ) { switch e := e . ( type ) { case * bzl . ListExpr : e . ForceMultiLine = true case * bzl . CallExpr : e . List [ 0 ] . ( * bzl . DictExpr ) . ForceMultiLine = true } } var parts [ ] bzl . Expr if ps . generic != nil { parts = append ( parts , ps . generic ) } if ps . os != nil { parts = append ( parts , makeSelect ( ps . os ) ) } if ps . arch != nil { parts = append ( parts , makeSelect ( ps . arch ) ) } if ps . platform != nil { parts = append ( parts , makeSelect ( ps . platform ) ) } if len ( parts ) == 0 { return nil } if len ( parts ) == 1 { return parts [ 0 ] } expr := parts [ 0 ] forceMultiline ( expr ) for _ , part := range parts [ 1 : ] { forceMultiline ( part ) expr = & bzl . BinaryExpr { Op : " " , X : expr , Y : part , } } return expr }
// makePlatformStringsExpr constructs a single expression from the
// sub-expressions in ps.
makePlatformStringsExpr constructs a single expression from the sub - expressions in ps .