Skip to content

Commit

Permalink
cue: remove aliases used for refactoring
Browse files Browse the repository at this point in the history
Change-Id: I8843e418564ac934ca5829a1e472008ed98d081d
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7725
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Nov 22, 2020
1 parent 1e0faf0 commit b687b7f
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 141 deletions.
64 changes: 0 additions & 64 deletions cue/alias.go

This file was deleted.

2 changes: 1 addition & 1 deletion cue/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (c *context) str(v adt.Node) string {
return debugStr(c, v)
}

func (c *context) mkErr(src source, args ...interface{}) *bottom {
func (c *context) mkErr(src adt.Node, args ...interface{}) *adt.Bottom {
return c.index.mkErr(src, args...)
}

Expand Down
16 changes: 8 additions & 8 deletions cue/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"cuelang.org/go/internal/core/adt"
)

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

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

func exists(v value) bool {
if err, ok := v.(*bottom); ok {
func exists(v adt.Expr) bool {
if err, ok := v.(*adt.Bottom); ok {
return err.Code != codeNotExist
}
return true
}

func (idx *index) mkErr(src source, args ...interface{}) *bottom {
func (idx *index) mkErr(src adt.Node, args ...interface{}) *adt.Bottom {
var e *adt.Bottom
var code errCode = -1
outer:
for i, a := range args {
switch x := a.(type) {
case errCode:
code = x
case *bottom:
case *adt.Bottom:
e = adt.CombineErrors(nil, e, x)
case []*bottom:
case []*adt.Bottom:
for _, b := range x {
e = adt.CombineErrors(nil, e, b)
}
case errors.Error:
e = adt.CombineErrors(nil, e, &adt.Bottom{Err: x})
case value:
case adt.Expr:
case string:
args := args[i+1:]
// Do not expand message so that errors can be localized.
Expand Down
4 changes: 2 additions & 2 deletions cue/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (inst *Instance) setError(err errors.Error) {
inst.Err = errors.Append(inst.Err, err)
}

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

// evalExpr evaluates expr within scope.
func evalExpr(ctx *context, scope *adt.Vertex, expr ast.Expr) evaluated {
func evalExpr(ctx *context, scope *adt.Vertex, expr ast.Expr) adt.Value {
cfg := &compile.Config{
Scope: scope,
Imports: func(x *ast.Ident) (pkgPath string) {
Expand Down

0 comments on commit b687b7f

Please sign in to comment.