Skip to content

Commit

Permalink
tools/fix: remove rewriting support for old-style let
Browse files Browse the repository at this point in the history
This has been deprecated for a long time and we soon want
to support aliases for embeddings.

Issue #867

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: I10478888c1a60e2b1280279edefc264d50f3f45b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/541457
Unity-Result: CUEcueckoo <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Paul Jolly <[email protected]>
  • Loading branch information
mpvl committed Jul 23, 2022
1 parent 580edf4 commit 9a66c51
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
23 changes: 0 additions & 23 deletions tools/fix/fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,6 @@ func File(f *ast.File, o ...Option) *ast.File {
return true
}, nil).(*ast.File)

// Rewrite an old-style alias to a let clause.
ast.Walk(f, func(n ast.Node) bool {
var decls []ast.Decl
switch x := n.(type) {
case *ast.StructLit:
decls = x.Elts
case *ast.File:
decls = x.Decls
}
for i, d := range decls {
if a, ok := d.(*ast.Alias); ok {
x := &ast.LetClause{
Ident: a.Ident,
Equal: a.Equal,
Expr: a.Expr,
}
astutil.CopyMeta(x, a)
decls[i] = x
}
}
return true
}, nil)

// Rewrite block comments to regular comments.
ast.Walk(f, func(n ast.Node) bool {
switch x := n.(type) {
Expand Down
7 changes: 0 additions & 7 deletions tools/fix/fix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ a: __div(1, 2)
b: __mod(3, 5)
c: __quo(2, 9)
d: __rem(1.0, 1.0) // pass on illegal values.
`,
}, {
in: `
y = foo
`,
out: `
let y = foo
`,
}, {
simplify: true,
Expand Down

0 comments on commit 9a66c51

Please sign in to comment.