@@ -21,6 +21,7 @@ import (
21
21
"cuelang.org/go/cue"
22
22
"cuelang.org/go/cue/token"
23
23
"cuelang.org/go/internal/core/adt"
24
+ "cuelang.org/go/internal/value"
24
25
"github.com/cockroachdb/apd/v2"
25
26
)
26
27
@@ -48,7 +49,7 @@ func (c *CallCtxt) Do() bool {
48
49
}
49
50
50
51
func (c * CallCtxt ) Value (i int ) cue.Value {
51
- v := cue . MakeValue (c .ctx , c .args [i ])
52
+ v := value . Make (c .ctx , c .args [i ])
52
53
// TODO: remove default
53
54
// v, _ = v.Default()
54
55
if ! v .IsConcrete () {
@@ -58,7 +59,7 @@ func (c *CallCtxt) Value(i int) cue.Value {
58
59
}
59
60
60
61
func (c * CallCtxt ) Struct (i int ) * cue.Struct {
61
- v := cue . MakeValue (c .ctx , c .args [i ])
62
+ v := value . Make (c .ctx , c .args [i ])
62
63
s , err := v .Struct ()
63
64
if err != nil {
64
65
c .invalidArgType (c .args [i ], i , "struct" , err )
@@ -76,7 +77,7 @@ func (c *CallCtxt) Int64(i int) int64 { return int64(c.intValue(i, 64, "int64"))
76
77
77
78
func (c * CallCtxt ) intValue (i , bits int , typ string ) int64 {
78
79
arg := c .args [i ]
79
- x := cue . MakeValue (c .ctx , arg )
80
+ x := value . Make (c .ctx , arg )
80
81
n , err := x .Int (nil )
81
82
if err != nil {
82
83
c .invalidArgType (arg , i , typ , err )
@@ -98,7 +99,7 @@ func (c *CallCtxt) Uint32(i int) uint32 { return uint32(c.uintValue(i, 32, "uint
98
99
func (c * CallCtxt ) Uint64 (i int ) uint64 { return uint64 (c .uintValue (i , 64 , "uint64" )) }
99
100
100
101
func (c * CallCtxt ) uintValue (i , bits int , typ string ) uint64 {
101
- x := cue . MakeValue (c .ctx , c .args [i ])
102
+ x := value . Make (c .ctx , c .args [i ])
102
103
n , err := x .Int (nil )
103
104
if err != nil || n .Sign () < 0 {
104
105
c .invalidArgType (c .args [i ], i , typ , err )
@@ -113,7 +114,7 @@ func (c *CallCtxt) uintValue(i, bits int, typ string) uint64 {
113
114
}
114
115
115
116
func (c * CallCtxt ) Decimal (i int ) * apd.Decimal {
116
- x := cue . MakeValue (c .ctx , c .args [i ])
117
+ x := value . Make (c .ctx , c .args [i ])
117
118
if _ , err := x .MantExp (nil ); err != nil {
118
119
c .invalidArgType (c .args [i ], i , "Decimal" , err )
119
120
return nil
@@ -122,7 +123,7 @@ func (c *CallCtxt) Decimal(i int) *apd.Decimal {
122
123
}
123
124
124
125
func (c * CallCtxt ) Float64 (i int ) float64 {
125
- x := cue . MakeValue (c .ctx , c .args [i ])
126
+ x := value . Make (c .ctx , c .args [i ])
126
127
res , err := x .Float64 ()
127
128
if err != nil {
128
129
c .invalidArgType (c .args [i ], i , "float64" , err )
@@ -132,7 +133,7 @@ func (c *CallCtxt) Float64(i int) float64 {
132
133
}
133
134
134
135
func (c * CallCtxt ) BigInt (i int ) * big.Int {
135
- x := cue . MakeValue (c .ctx , c .args [i ])
136
+ x := value . Make (c .ctx , c .args [i ])
136
137
n , err := x .Int (nil )
137
138
if err != nil {
138
139
c .invalidArgType (c .args [i ], i , "int" , err )
@@ -144,7 +145,7 @@ func (c *CallCtxt) BigInt(i int) *big.Int {
144
145
var ten = big .NewInt (10 )
145
146
146
147
func (c * CallCtxt ) BigFloat (i int ) * big.Float {
147
- x := cue . MakeValue (c .ctx , c .args [i ])
148
+ x := value . Make (c .ctx , c .args [i ])
148
149
var mant big.Int
149
150
exp , err := x .MantExp (& mant )
150
151
if err != nil {
@@ -163,7 +164,7 @@ func (c *CallCtxt) BigFloat(i int) *big.Float {
163
164
164
165
func (c * CallCtxt ) String (i int ) string {
165
166
// TODO: use Evaluate instead.
166
- x := cue . MakeValue (c .ctx , c .args [i ])
167
+ x := value . Make (c .ctx , c .args [i ])
167
168
v , err := x .String ()
168
169
if err != nil {
169
170
c .invalidArgType (c .args [i ], i , "string" , err )
@@ -173,7 +174,7 @@ func (c *CallCtxt) String(i int) string {
173
174
}
174
175
175
176
func (c * CallCtxt ) Bytes (i int ) []byte {
176
- x := cue . MakeValue (c .ctx , c .args [i ])
177
+ x := value . Make (c .ctx , c .args [i ])
177
178
v , err := x .Bytes ()
178
179
if err != nil {
179
180
c .invalidArgType (c .args [i ], i , "bytes" , err )
@@ -183,7 +184,7 @@ func (c *CallCtxt) Bytes(i int) []byte {
183
184
}
184
185
185
186
func (c * CallCtxt ) Reader (i int ) io.Reader {
186
- x := cue . MakeValue (c .ctx , c .args [i ])
187
+ x := value . Make (c .ctx , c .args [i ])
187
188
// TODO: optimize for string and bytes cases
188
189
r , err := x .Reader ()
189
190
if err != nil {
@@ -194,7 +195,7 @@ func (c *CallCtxt) Reader(i int) io.Reader {
194
195
}
195
196
196
197
func (c * CallCtxt ) Bool (i int ) bool {
197
- x := cue . MakeValue (c .ctx , c .args [i ])
198
+ x := value . Make (c .ctx , c .args [i ])
198
199
b , err := x .Bool ()
199
200
if err != nil {
200
201
c .invalidArgType (c .args [i ], i , "bool" , err )
@@ -205,7 +206,7 @@ func (c *CallCtxt) Bool(i int) bool {
205
206
206
207
func (c * CallCtxt ) List (i int ) (a []cue.Value ) {
207
208
arg := c .args [i ]
208
- x := cue . MakeValue (c .ctx , arg )
209
+ x := value . Make (c .ctx , arg )
209
210
v , err := x .List ()
210
211
if err != nil {
211
212
c .invalidArgType (c .args [i ], i , "list" , err )
@@ -219,7 +220,7 @@ func (c *CallCtxt) List(i int) (a []cue.Value) {
219
220
220
221
func (c * CallCtxt ) Iter (i int ) (a cue.Iterator ) {
221
222
arg := c .args [i ]
222
- x := cue . MakeValue (c .ctx , arg )
223
+ x := value . Make (c .ctx , arg )
223
224
v , err := x .List ()
224
225
if err != nil {
225
226
c .invalidArgType (c .args [i ], i , "list" , err )
0 commit comments