cue/ast: allow LetClause in NewStruct

Change-Id: I386ba6c903e4ea9211b46be518d300e35f74b932
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/5960
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/cue/ast/ast.go b/cue/ast/ast.go
index e058394..798f73a 100644
--- a/cue/ast/ast.go
+++ b/cue/ast/ast.go
@@ -481,10 +481,10 @@
 
 // NewStruct creates a struct from the given fields.
 //
-// A field is either a *Field, an *Elipsis, a *CommentGroup, or a Label,
-// optionally followed by a a token.OPTION to indicate the field is optional,
-// optionally followed by a token.ISA to indicate the field is a defintion
-// followed by an expression for the field value.
+// A field is either a *Field, an *Elipsis, *LetClause, a *CommentGroup, or a
+// Label, optionally followed by a a token.OPTION to indicate the field is
+// optional, optionally followed by a token.ISA to indicate the field is a
+// defintion followed by an expression for the field value.
 //
 // It will panic if a values not matching these patterns are given. Useful for
 // ASTs generated by code other than the CUE parser.
@@ -511,6 +511,9 @@
 		case *Ellipsis:
 			s.Elts = append(s.Elts, x)
 			continue
+		case *LetClause:
+			s.Elts = append(s.Elts, x)
+			continue
 		case Label:
 			label = x
 		case string: