- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 40 for CompositeLit (0.26 sec)
-
src/cmd/gofmt/simplify.go
package main import ( "go/ast" "go/token" "reflect" ) type simplifier struct{} func (s simplifier) Visit(node ast.Node) ast.Visitor { switch n := node.(type) { case *ast.CompositeLit: // array, slice, and map composite literals may be simplified outer := n var keyType, eltType ast.Expr switch typ := outer.Type.(type) { case *ast.ArrayType: eltType = typ.Elt case *ast.MapType:
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 19 20:06:14 UTC 2022 - 4.8K bytes - Viewed (0) -
src/cmd/fix/netipv6zone.go
https://codereview.appspot.com/6849045/ `, } func netipv6zone(f *ast.File) bool { if !imports(f, "net") { return false } fixed := false walk(f, func(n any) { cl, ok := n.(*ast.CompositeLit) if !ok { return } se, ok := cl.Type.(*ast.SelectorExpr) if !ok { return } if !isTopName(se.X, "net") || se.Sel == nil { return } switch ss := se.Sel.String(); ss {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Dec 13 18:45:54 UTC 2021 - 1.3K bytes - Viewed (0) -
src/cmd/compile/internal/syntax/nodes_test.go
{"BasicLit", `@0x123`}, {"BasicLit", `@3.1415`}, {"BasicLit", `@.2718`}, {"BasicLit", `@1i`}, {"BasicLit", `@'a'`}, {"BasicLit", `@"abc"`}, {"BasicLit", "@`abc`"}, {"CompositeLit", `@{}`}, {"CompositeLit", `T@{}`}, {"CompositeLit", `struct{x, y int}@{}`}, {"KeyValueExpr", `"foo"@: true`}, {"KeyValueExpr", `"a"@: b`}, {"FuncLit", `@func (){}`}, {"ParenExpr", `@(x)`}, {"SelectorExpr", `a@.b`},
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Nov 02 18:45:06 UTC 2023 - 8.7K bytes - Viewed (0) -
src/go/doc/exports.go
func filterCompositeLit(lit *ast.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 []ast.Expr, filter Filter, export bool) []ast.Expr { j := 0 for _, exp := range list { switch x := exp.(type) { case *ast.CompositeLit: filterCompositeLit(x, filter, export)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Apr 01 18:18:07 UTC 2022 - 8.5K bytes - Viewed (0) -
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) -
src/cmd/fix/printerconfig.go
} func printerconfig(f *ast.File) bool { if !imports(f, "go/printer") { return false } fixed := false walk(f, func(n any) { cl, ok := n.(*ast.CompositeLit) if !ok { return } se, ok := cl.Type.(*ast.SelectorExpr) if !ok { return } if !isTopName(se.X, "printer") || se.Sel == nil { return }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Dec 13 18:45:54 UTC 2021 - 1.1K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/composite/composite.go
// unkeyed fields. func run(pass *analysis.Pass) (interface{}, error) { inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector) nodeFilter := []ast.Node{ (*ast.CompositeLit)(nil), } inspect.Preorder(nodeFilter, func(n ast.Node) { cl := n.(*ast.CompositeLit) typ := pass.TypesInfo.Types[cl].Type if typ == nil { // cannot determine composite literals' type, skip it return } typeName := typ.String()
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Apr 02 02:20:05 UTC 2024 - 4.4K bytes - Viewed (0) -
src/cmd/compile/internal/syntax/positions.go
// case *ImportDecl: // case *ConstDecl: // case *TypeDecl: // case *VarDecl: // case *FuncDecl: // expressions // case *BadExpr: // case *Name: // case *BasicLit: case *CompositeLit: if n.Type != nil { m = n.Type continue } return n.Pos() case *KeyValueExpr: m = n.Key // case *FuncLit: // case *ParenExpr: case *SelectorExpr: m = n.X
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Jun 10 17:49:19 UTC 2024 - 6.5K bytes - Viewed (0) -
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) -
src/go/parser/parser_test.go
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Jan 31 20:26:14 UTC 2024 - 24.6K bytes - Viewed (0)