cue: fix semantics of field comprehensions

They were previously defined as struct comprehensions,
which is slightly different.

As a result, trim’s behavior changed, as this change makes
it harder to detect whether the source of a field is a
comprehension in evaluated code.

Change-Id: I59ec737bc8cc22cc4bc5909fbc9dc7e7d7c7aa5c
diff --git a/cue/ast.go b/cue/ast.go
index 2591bbd..37b92dc 100644
--- a/cue/ast.go
+++ b/cue/ast.go
@@ -42,17 +42,12 @@
 		return result.(*bottom)
 	}
 
-	for _, c := range v.comprehensions {
-		inst.rootValue = mkBin(v.ctx(), token.NoPos, opUnify, inst.rootValue, c)
-	}
-
 	return nil
 }
 
 type astVisitor struct {
 	*astState
-	object         *structLit
-	comprehensions []*structComprehension
+	object *structLit
 
 	inSelector int
 }
@@ -164,9 +159,6 @@
 				v1.walk(e)
 			}
 		}
-		for _, c := range v1.comprehensions {
-			v.comprehensions = append(v.comprehensions, c)
-		}
 		value = obj
 
 	case *ast.ImportDecl:
@@ -198,17 +190,10 @@
 			}
 		}
 		value = obj
-		for i, c := range v1.comprehensions {
-			if i == 0 && obj.template == nil && len(obj.arcs) == 0 {
-				value = c
-				continue
-			}
-			value = mkBin(v.ctx(), token.NoPos, opUnify, value, c)
-		}
 
 	case *ast.ComprehensionDecl:
 		yielder := &yield{baseValue: newExpr(n.Field.Value)}
-		sc := &structComprehension{
+		fc := &fieldComprehension{
 			baseValue: newDecl(n),
 			clauses:   wrapClauses(v, yielder, n.Clauses),
 		}
@@ -228,7 +213,7 @@
 			v.setScope(field, template)
 			template.value = v.walk(field.Value)
 			yielder.value = template
-			sc.isTemplate = true
+			fc.isTemplate = true
 
 		case *ast.BasicLit, *ast.Ident:
 			name, ok := ast.LabelName(x)
@@ -245,19 +230,19 @@
 		}
 		// yielder.key = v.walk(n.Field.Label)
 		// yielder.value = v.walk(n.Field.Value)
-		v.comprehensions = append(v.comprehensions, sc)
+		v.object.comprehensions = append(v.object.comprehensions, fc)
 
 	case *ast.Field:
 		switch x := n.Label.(type) {
 		case *ast.Interpolation:
 			yielder := &yield{baseValue: newNode(x)}
-			sc := &structComprehension{
+			fc := &fieldComprehension{
 				baseValue: newDecl(n),
 				clauses:   yielder,
 			}
 			yielder.key = v.walk(x)
 			yielder.value = v.walk(n.Value)
-			v.comprehensions = append(v.comprehensions, sc)
+			v.object.comprehensions = append(v.object.comprehensions, fc)
 
 		case *ast.TemplateLabel:
 			f := v.label(x.Ident.Name, true)