cue: precompile regular expressions

This can result in a pretty significant
performance gain.

Change-Id: Id77976eac1afb0e1ea461ae5c65a9a1785d346e3
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2350
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/ast.go b/cue/ast.go
index 797dc60..2b5bab4 100644
--- a/cue/ast.go
+++ b/cue/ast.go
@@ -258,7 +258,7 @@
 		list := &list{baseValue: newExpr(n), elem: s}
 		list.initLit()
 		if n.Ellipsis != token.NoPos || n.Type != nil {
-			list.len = newBound(list.baseValue, opGeq, intKind, list.len)
+			list.len = newBound(v.ctx(), list.baseValue, opGeq, intKind, list.len)
 			if n.Type != nil {
 				list.typ = v1.walk(n.Type)
 			}
@@ -313,7 +313,7 @@
 			// to rewrite it.
 
 			if name != "" {
-				yielder.key = &stringLit{newNode(x), name}
+				yielder.key = &stringLit{newNode(x), name, nil}
 				yielder.value = v.walk(field.Value)
 			}
 
@@ -553,6 +553,7 @@
 		case token.GEQ, token.GTR, token.LSS, token.LEQ,
 			token.NEQ, token.MAT, token.NMAT:
 			value = newBound(
+				v.ctx(),
 				newExpr(n),
 				tokenMap[n.Op],
 				topKind|nonGround,
@@ -574,12 +575,12 @@
 			value = d
 
 		default:
-			value = &binaryExpr{
+			value = updateBin(v.ctx(), &binaryExpr{
 				newExpr(n),
 				tokenMap[n.Op], // op
 				v.walk(n.X),    // left
 				v.walk(n.Y),    // right
-			}
+			})
 		}
 
 	case *ast.CommentGroup: