Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 16 for CompositeLit (0.16 sec)

  1. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock/copylock.go

    }
    
    func run(pass *analysis.Pass) (interface{}, error) {
    	inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
    
    	nodeFilter := []ast.Node{
    		(*ast.AssignStmt)(nil),
    		(*ast.CallExpr)(nil),
    		(*ast.CompositeLit)(nil),
    		(*ast.FuncDecl)(nil),
    		(*ast.FuncLit)(nil),
    		(*ast.GenDecl)(nil),
    		(*ast.RangeStmt)(nil),
    		(*ast.ReturnStmt)(nil),
    	}
    	inspect.Preorder(nodeFilter, func(node ast.Node) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 16:19:04 UTC 2024
    - 9.9K bytes
    - Viewed (0)
  2. src/go/ast/filter.go

    	return
    }
    
    func filterCompositeLit(lit *CompositeLit, filter Filter, export bool) {
    	n := len(lit.Elts)
    	lit.Elts = filterExprList(lit.Elts, filter, export)
    	if len(lit.Elts) < n {
    		lit.Incomplete = true
    	}
    }
    
    func filterExprList(list []Expr, filter Filter, export bool) []Expr {
    	j := 0
    	for _, exp := range list {
    		switch x := exp.(type) {
    		case *CompositeLit:
    			filterCompositeLit(x, filter, export)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  3. src/go/parser/parser_test.go

    	{name: "arraylit", format: "package main; var x = «[1]any{«nil»}»", parseMultiplier: 2},         // Parser nodes: UnaryExpr, CompositeLit
    	{name: "structlit", format: "package main; var x = «struct{x any}{«nil»}»", parseMultiplier: 2}, // Parser nodes: UnaryExpr, CompositeLit
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 31 20:26:14 UTC 2024
    - 24.6K bytes
    - Viewed (0)
  4. src/go/ast/ast.go

    	}
    
    	// A FuncLit node represents a function literal.
    	FuncLit struct {
    		Type *FuncType  // function type
    		Body *BlockStmt // function body
    	}
    
    	// A CompositeLit node represents a composite literal.
    	CompositeLit struct {
    		Type       Expr      // literal type; or nil
    		Lbrace     token.Pos // position of "{"
    		Elts       []Expr    // list of composite elements; or nil
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 28 21:32:41 UTC 2024
    - 35.6K bytes
    - Viewed (0)
  5. src/cmd/vendor/golang.org/x/tools/go/ast/astutil/enclosing.go

    				tok(n.Case, len("case")))
    		}
    		children = append(children, tok(n.Colon, len(":")))
    
    	case *ast.Comment:
    		// nop
    
    	case *ast.CommentGroup:
    		// nop
    
    	case *ast.CompositeLit:
    		children = append(children,
    			tok(n.Lbrace, len("{")),
    			tok(n.Rbrace, len("{")))
    
    	case *ast.DeclStmt:
    		// nop
    
    	case *ast.DeferStmt:
    		children = append(children,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 18 21:28:13 UTC 2023
    - 15.9K bytes
    - Viewed (0)
  6. src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go

    		return ast.NewIdent("nil")
    	case *types.Struct:
    		texpr := TypeExpr(f, pkg, typ) // typ because we want the name here.
    		if texpr == nil {
    			return nil
    		}
    		return &ast.CompositeLit{
    			Type: texpr,
    		}
    	}
    	return nil
    }
    
    // IsZeroValue checks whether the given expression is a 'zero value' (as determined by output of
    // analysisinternal.ZeroValue)
    func IsZeroValue(expr ast.Expr) bool {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 16:19:04 UTC 2024
    - 11.7K bytes
    - Viewed (0)
  7. src/cmd/cgo/ast.go

    	case *ast.Ident:
    	case *ast.Ellipsis:
    		f.walk(&n.Elt, ctxType, visit)
    	case *ast.BasicLit:
    	case *ast.FuncLit:
    		f.walk(n.Type, ctxType, visit)
    		f.walk(n.Body, ctxStmt, visit)
    	case *ast.CompositeLit:
    		f.walk(&n.Type, ctxType, visit)
    		f.walk(n.Elts, ctxExpr, visit)
    	case *ast.ParenExpr:
    		f.walk(&n.X, context, visit)
    	case *ast.SelectorExpr:
    		f.walk(&n.X, ctxSelector, visit)
    	case *ast.IndexExpr:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jun 07 16:54:27 UTC 2023
    - 14.3K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go

    		// nothing to do
    
    	case *ast.Ellipsis:
    		a.apply(n, "Elt", nil, n.Elt)
    
    	case *ast.FuncLit:
    		a.apply(n, "Type", nil, n.Type)
    		a.apply(n, "Body", nil, n.Body)
    
    	case *ast.CompositeLit:
    		a.apply(n, "Type", nil, n.Type)
    		a.applyList(n, "Elts")
    
    	case *ast.ParenExpr:
    		a.apply(n, "X", nil, n.X)
    
    	case *ast.SelectorExpr:
    		a.apply(n, "X", nil, n.X)
    		a.apply(n, "Sel", nil, n.Sel)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 18 21:28:13 UTC 2023
    - 12.2K bytes
    - Viewed (0)
  9. src/cmd/fix/fix.go

    	case *ast.Ellipsis:
    		walkBeforeAfter(&n.Elt, before, after)
    	case *ast.BasicLit:
    	case *ast.FuncLit:
    		walkBeforeAfter(&n.Type, before, after)
    		walkBeforeAfter(&n.Body, before, after)
    	case *ast.CompositeLit:
    		walkBeforeAfter(&n.Type, before, after)
    		walkBeforeAfter(&n.Elts, before, after)
    	case *ast.ParenExpr:
    		walkBeforeAfter(&n.X, before, after)
    	case *ast.SelectorExpr:
    		walkBeforeAfter(&n.X, before, after)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 14.6K bytes
    - Viewed (0)
  10. src/go/types/generate_test.go

    		switch n := n.(type) {
    		case *ast.ValueSpec:
    			// rewrite type Typ = [...]Type{...} to type Typ = []Type{...}
    			if len(n.Names) == 1 && n.Names[0].Name == "Typ" && len(n.Values) == 1 {
    				n.Values[0].(*ast.CompositeLit).Type.(*ast.ArrayType).Len = nil
    				return false
    			}
    		}
    		return true
    	})
    }
    
    // fixSprintf adds an extra nil argument for the *token.FileSet parameter in sprintf calls.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 16.5K bytes
    - Viewed (0)
Back to top