...

Text file src/go/parser/testdata/resolution/resolution.src

Documentation: go/parser/testdata/resolution

     1// Copyright 2021 The Go Authors. All rights reserved.
     2// Use of this source code is governed by a BSD-style
     3// license that can be found in the LICENSE file.
     4
     5package resolution
     6
     7func f /* =@fdecl */(n /* =@narg */ ast.Node) bool {
     8		if n /* =@ninit */, ok /* =@ok */ := n /* @narg */ .(*ast.SelectorExpr); ok /* @ok */ {
     9			sel = n /* @ninit */
    10	}
    11}
    12
    13type c /* =@cdecl */ map[token.Pos]resolvedObj
    14
    15func (v /* =@vdecl */ c /* @cdecl */) Visit(node /* =@nodearg */ ast.Node) (w /* =@w */ ast.Visitor) {}
    16
    17const (
    18	basic /* =@basic */ = iota
    19	labelOk // =@labelOk
    20)
    21
    22type T /* =@T */ int
    23
    24func _(count /* =@count */ T /* @T */) {
    25	x /* =@x1 */ := c /* @cdecl */{}
    26	switch x /* =@x2 */ := x /* @x1 */; x /* =@x3 */ := x /* @x2 */.(type) {
    27	case c /* @cdecl */:
    28	default:
    29	}
    30loop /* =@loop */:
    31	for {
    32		if true {
    33			break loop /* @loop */
    34		}
    35	}
    36	select {
    37	case err /* =@err1 */ := <-_:
    38		return err /* @err1 */
    39	case err /* =@err2 */ := <-_:
    40		return err /* @err2 */
    41	}
    42
    43	_ = func(p1 /* =@p1 */ int, p2 /* =@p2 */ p1) {
    44		closed /* =@closed */ := p1 // @p1
    45		shadowed /* =@shadowed1 */ := p2 // @p2
    46		_ = func(shadowed /* =@shadowed2 */ p2 /* @p2 */) {
    47			closed /* @closed */ = 1
    48			shadowed /* @shadowed2 */ = 2
    49		}
    50	}
    51}
    52
    53func (r /* =@r */ c /* @cdecl */) m(_ r) c /* @cdecl */ { return r /* @r */ }
    54
    55var cycle /* =@cycle */ = cycle /* @cycle */ + 1
    56
    57type chain /* =@chain */ struct {
    58	next /* =@next */ *chain /* @chain */
    59}
    60
    61func recursive /* =@recursive */() {
    62	recursive /* @recursive */ ()
    63}

View as plain text