Skip to content

Commit b687b7f

Browse files
committed
cue: remove aliases used for refactoring
Change-Id: I8843e418564ac934ca5829a1e472008ed98d081d Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7725 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent 1e0faf0 commit b687b7f

File tree

5 files changed

+77
-141
lines changed

5 files changed

+77
-141
lines changed

cue/alias.go

Lines changed: 0 additions & 64 deletions
This file was deleted.

cue/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (c *context) str(v adt.Node) string {
5555
return debugStr(c, v)
5656
}
5757

58-
func (c *context) mkErr(src source, args ...interface{}) *bottom {
58+
func (c *context) mkErr(src adt.Node, args ...interface{}) *adt.Bottom {
5959
return c.index.mkErr(src, args...)
6060
}
6161

cue/errors.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"cuelang.org/go/internal/core/adt"
2121
)
2222

23-
func (v Value) toErr(b *bottom) (err errors.Error) {
23+
func (v Value) toErr(b *adt.Bottom) (err errors.Error) {
2424
errs := errors.Errors(b.Err)
2525
if len(errs) > 1 {
2626
for _, e := range errs {
@@ -38,7 +38,7 @@ var _ errors.Error = &valueError{}
3838
// A valueError is returned as a result of evaluating a value.
3939
type valueError struct {
4040
v Value
41-
err *bottom
41+
err *adt.Bottom
4242
}
4343

4444
func (e *valueError) Unwrap() error {
@@ -101,30 +101,30 @@ var errNotExists = &adt.Bottom{
101101
Err: errors.Newf(token.NoPos, "undefined value"),
102102
}
103103

104-
func exists(v value) bool {
105-
if err, ok := v.(*bottom); ok {
104+
func exists(v adt.Expr) bool {
105+
if err, ok := v.(*adt.Bottom); ok {
106106
return err.Code != codeNotExist
107107
}
108108
return true
109109
}
110110

111-
func (idx *index) mkErr(src source, args ...interface{}) *bottom {
111+
func (idx *index) mkErr(src adt.Node, args ...interface{}) *adt.Bottom {
112112
var e *adt.Bottom
113113
var code errCode = -1
114114
outer:
115115
for i, a := range args {
116116
switch x := a.(type) {
117117
case errCode:
118118
code = x
119-
case *bottom:
119+
case *adt.Bottom:
120120
e = adt.CombineErrors(nil, e, x)
121-
case []*bottom:
121+
case []*adt.Bottom:
122122
for _, b := range x {
123123
e = adt.CombineErrors(nil, e, b)
124124
}
125125
case errors.Error:
126126
e = adt.CombineErrors(nil, e, &adt.Bottom{Err: x})
127-
case value:
127+
case adt.Expr:
128128
case string:
129129
args := args[i+1:]
130130
// Do not expand message so that errors can be localized.

cue/instance.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (inst *Instance) setError(err errors.Error) {
165165
inst.Err = errors.Append(inst.Err, err)
166166
}
167167

168-
func (inst *Instance) eval(ctx *context) evaluated {
168+
func (inst *Instance) eval(ctx *context) adt.Value {
169169
// TODO: remove manifest here?
170170
v := ctx.manifest(inst.root)
171171
return v
@@ -186,7 +186,7 @@ func pkgID() string {
186186
}
187187

188188
// evalExpr evaluates expr within scope.
189-
func evalExpr(ctx *context, scope *adt.Vertex, expr ast.Expr) evaluated {
189+
func evalExpr(ctx *context, scope *adt.Vertex, expr ast.Expr) adt.Value {
190190
cfg := &compile.Config{
191191
Scope: scope,
192192
Imports: func(x *ast.Ident) (pkgPath string) {

0 commit comments

Comments
 (0)