_linters/src/honnef.co/go/tools/ssa/builder.go
func (b *builder) localValueSpec(fn *Function, spec *ast.ValueSpec) {
	switch {
	case len(spec.Values) == len(spec.Names):
		// e.g. var x, y = 0, 1
		// 1:1 assignment
		for i, id := range spec.Names {
			if !isBlankIdent(id) {
				fn.addLocalForIdent(id)
			}
			lval := b.addr(fn, id, false) // non-escaping
			b.assign(fn, lval, spec.Values[i], true, nil)
		}

	case len(spec.Values) == 0:
		// e.g. var x, y int
		// Locals are implicitly zero-initialized.
		for _, id := range spec.Names {
			if !isBlankIdent(id) {
				lhs := fn.addLocalForIdent(id)
				if fn.debugInfo() {
					emitDebugRef(fn, id, lhs, true)
				}
			}
		}

	default:
		// e.g. var x, y = pos()
		tuple := b.exprN(fn, spec.Values[0])
		for i, id := range spec.Names {
			if !isBlankIdent(id) {
				fn.addLocalForIdent(id)
				lhs := b.addr(fn, id, false) // non-escaping
				lhs.store(fn, emitExtract(fn, tuple, i))
			}
		}
	}
}
func (b *builder) localValueSpec(fn *Function, spec *ast.ValueSpec) {
	switch {
	case len(spec.Values) == len(spec.Names):
		// e.g. var x, y = 0, 1
		// 1:1 assignment
		for i, id := range spec.Names {
			if !isBlankIdent(id) {
				fn.addLocalForIdent(id)
			}
			lval := b.addr(fn, id, false) // non-escaping
			b.assign(fn, lval, spec.Values[i], true, nil)
		}

	case len(spec.Values) == 0:
		// e.g. var x, y int
		// Locals are implicitly zero-initialized.
		for _, id := range spec.Names {
			if !isBlankIdent(id) {
				lhs := fn.addLocalForIdent(id)
				if fn.debugInfo() {
					emitDebugRef(fn, id, lhs, true)
				}
			}
		}

	default:
		// e.g. var x, y = pos()
		tuple := b.exprN(fn, spec.Values[0])
		for i, id := range spec.Names {
			if !isBlankIdent(id) {
				fn.addLocalForIdent(id)
				lhs := b.addr(fn, id, false) // non-escaping
				lhs.store(fn, emitExtract(fn, tuple, i))
			}
		}
	}
}
func ( b * builder ) localValueSpec ( fn * Function , spec * ast . ValueSpec ) { switch { case len ( spec . Values ) == len ( spec . Names ) : // e.g. var x, y = 0, 1 // 1:1 assignment for i , id := range spec . Names { if ! isBlankIdent ( id ) { fn . addLocalForIdent ( id ) } lval := b . addr ( fn , id , false ) // non-escaping b . assign ( fn , lval , spec . Values [ i ] , true , nil ) } case len ( spec . Values ) == 0 : // e.g. var x, y int // Locals are implicitly zero-initialized. for _ , id := range spec . Names { if ! isBlankIdent ( id ) { lhs := fn . addLocalForIdent ( id ) if fn . debugInfo ( ) { emitDebugRef ( fn , id , lhs , true ) } } } default : // e.g. var x, y = pos() tuple := b . exprN ( fn , spec . Values [ 0 ] ) for i , id := range spec . Names { if ! isBlankIdent ( id ) { fn . addLocalForIdent ( id ) lhs := b . addr ( fn , id , false ) // non-escaping lhs . store ( fn , emitExtract ( fn , tuple , i ) ) } } } }
// localValueSpec emits to fn code to define all of the vars in the
// function-local ValueSpec, spec.
//
localValueSpec emits to fn code to define all of the vars in the function - local ValueSpec spec .