package types
import (
)
func ( *Checker) ( *operand) {
var Type
var constant.Value
switch .mode {
case invalid:
= Typ[Invalid]
case novalue:
= (*Tuple)(nil)
case constant_:
= .typ
= .val
default:
= .typ
}
assert(.expr != nil && != nil)
if isUntyped() {
.rememberUntyped(.expr, false, .mode, .(*Basic), )
} else {
.recordTypeAndValue(.expr, .mode, , )
}
}
func ( *Checker) () {
if !debug && !.recordTypes() {
return
}
for , := range .untyped {
if debug && isTyped(.typ) {
.dump("%v: %s (type %s) is typed", .Pos(), , .typ)
panic("unreachable")
}
.recordTypeAndValue(, .mode, .typ, .val)
}
}
func ( *Checker) ( ast.Expr, operandMode, Type, constant.Value) {
assert( != nil)
assert( != nil)
if == invalid {
return
}
if == constant_ {
assert( != nil)
assert(!isValid() || allBasic(, IsConstType))
}
if := .Types; != nil {
[] = TypeAndValue{, , }
}
.recordTypeAndValueInSyntax(, , , )
}
func ( *Checker) ( ast.Expr, *Signature) {
for {
.recordTypeAndValue(, builtin, , nil)
switch p := .(type) {
case *ast.Ident, *ast.SelectorExpr:
return
case *ast.ParenExpr:
= .X
default:
panic("unreachable")
}
}
}
func ( *Checker) ( ast.Expr, []*operand) {
assert( != nil)
assert(len() == 2)
if [0].mode == invalid {
return
}
, := [0].typ, [1].typ
assert(isTyped() && isTyped() && (allBoolean() || == universeError))
if := .Types; != nil {
for {
:= []
assert(.Type != nil)
:= .Pos()
.Type = NewTuple(
NewVar(, .pkg, "", ),
NewVar(, .pkg, "", ),
)
[] =
, := .(*ast.ParenExpr)
if == nil {
break
}
= .X
}
}
.recordCommaOkTypesInSyntax(, , )
}
func ( *Checker) ( ast.Expr, []Type, Type) {
:= instantiatedIdent()
assert( != nil)
assert( != nil)
if := .Instances; != nil {
[] = Instance{newTypeList(), }
}
}
func ( *Checker) ( *ast.Ident, Object) {
assert( != nil)
if := .Defs; != nil {
[] =
}
}
func ( *Checker) ( *ast.Ident, Object) {
assert( != nil)
assert( != nil)
if := .Uses; != nil {
[] =
}
}
func ( *Checker) ( ast.Node, Object) {
assert( != nil)
assert( != nil)
if := .Implicits; != nil {
[] =
}
}
func ( *Checker) ( *ast.SelectorExpr, SelectionKind, Type, Object, []int, bool) {
assert( != nil && ( == nil || len() > 0))
.recordUse(.Sel, )
if := .Selections; != nil {
[] = &Selection{, , , , }
}
}
func ( *Checker) ( ast.Node, *Scope) {
assert( != nil)
assert( != nil)
if := .Scopes; != nil {
[] =
}
}