MCPcopy Create free account
hub / github.com/despiteallobjections/amigo / exprN

Method exprN

types/builder.go:311–350  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

309}
310
311func (r *reader) exprN() Value {
312 b := r.b
313 typ := r.typ()
314 switch tag := r.tag().(type) {
315 case *CallExpr:
316 var c Call
317 r.setCall(&c.Call)
318 c.typ = typ
319 return b.emit(&c)
320
321 case *IndexExpr:
322 x, pos, index := r.expr(), r.pos(), r.expr()
323 lookup := &Lookup{
324 X: x,
325 Index: b.emitConv(index, x.Type().Underlying().(*Map).Key()),
326 CommaOk: true,
327 }
328 lookup.setType(typ)
329 lookup.setPos(pos)
330 return b.emit(lookup)
331
332 case *AssertExpr:
333 x, pos, typ := r.expr(), r.pos(), r.typ()
334 return b.emitTypeTest(x, typ, pos)
335
336 case *Operation:
337 pos, x := r.pos(), r.expr()
338 unop := &UnOp{
339 Op: Recv,
340 X: x,
341 CommaOk: true,
342 }
343 unop.setType(typ)
344 unop.setPos(pos)
345 return b.emit(unop)
346
347 default:
348 panic(fmt.Sprintf("exprN(%T) in %s", tag, b.Fn))
349 }
350}
351
352// builtin emits to fn SSA instructions to implement a call to the
353// built-in function obj with the specified arguments

Callers

nothing calls this directly

Calls 13

typMethod · 0.95
tagMethod · 0.95
setCallMethod · 0.95
exprMethod · 0.95
posMethod · 0.95
emitConvMethod · 0.80
KeyMethod · 0.80
setPosMethod · 0.80
emitTypeTestMethod · 0.80
UnderlyingMethod · 0.65
TypeMethod · 0.65
setTypeMethod · 0.65

Tested by

no test coverage detected