Skip to content

Commit d174bc0

Browse files
committed
internal/cue/adt: remove use of Default in node
It is not necessary to do this. This is mainly done to close open lists. But this only matters for comprehensions, which will handle open lists anyway. So all this does is extra work and potentially introduce a bug if the Vertex pointer is used for dereferencing or caching. Change-Id: I45102393f53673e1bb8a77c6a4709af242d4e976 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7781 Reviewed-by: Marcel van Lohuizen <[email protected]> Reviewed-by: CUE cueckoo <[email protected]>
1 parent 41afc87 commit d174bc0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

internal/core/adt/context.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,8 @@ func (c *OpContext) node(x Expr, scalar bool) *Vertex {
709709
return emptyNode
710710
}
711711
}
712-
return node.Default()
712+
713+
return node
713714
}
714715

715716
// Elems returns the elements of a list.

internal/core/adt/default.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ func (d *Disjunction) Default() Value {
4242
}
4343

4444
// Default returns the default value or itself if there is no default.
45+
//
46+
// It also closes a list, representing its default value.
4547
func (v *Vertex) Default() *Vertex {
4648
switch d := v.BaseValue.(type) {
4749
default:

0 commit comments

Comments
 (0)