Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
cue/format: tweaks to support embeddings
Browse files Browse the repository at this point in the history
allow:

Def :: {{
    a: int
}}

Change-Id: I55dea1b45fb10515a9d358a4a40b021be420d86b
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/3240
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Sep 10, 2019
1 parent 3c38bfc commit 982b194
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
7 changes: 5 additions & 2 deletions cue/format/node.go
Expand Up @@ -265,7 +265,7 @@ func (f *formatter) decl(decl ast.Decl) {
f.print(formfeed)
}
f.expr(n.Expr)
f.print(newline, newsection, nooverride) // force newline
f.print(newsection, noblank)

case *ast.Ellipsis:
f.ellipsis(n)
Expand Down Expand Up @@ -495,7 +495,10 @@ func (f *formatter) exprRaw(expr ast.Expr, prec1, depth int) {

ws = noblank
if f.lineout != l {
ws = newline | nooverride
ws |= newline
if f.lastTok != token.RBRACE && f.lastTok != token.RBRACK {
ws |= nooverride
}
}
f.print(ws, x.Rbrace, token.RBRACE)

Expand Down
6 changes: 2 additions & 4 deletions cue/format/testdata/expressions.golden
Expand Up @@ -155,15 +155,13 @@ package expressions
e: {for k, v in someObject if k > "a" {"\(k)": v}}
e: {for k, v in someObject if k > "a" {
"\(k)": v
}
}
}}

e: {
for k, v in someObject
if k > "a" {
"\(k)": v
}
}
}}

e: [{
a: 1, b: 2
Expand Down
1 change: 0 additions & 1 deletion doc/tutorial/kubernetes/README.md
Expand Up @@ -500,7 +500,6 @@ for x in [deployment, daemonSet, statefulSet] for k, v in x {
} for c in v.spec.template.spec.containers
for p in c.ports
if p._export ]
}
}
EOF
Expand Down

0 comments on commit 982b194

Please sign in to comment.