Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 35 for KeyValueExpr (0.27 sec)

  1. src/cmd/fix/netipv6zone.go

    				if _, ok := e.(*ast.KeyValueExpr); ok {
    					break
    				}
    				switch i {
    				case 0:
    					cl.Elts[i] = &ast.KeyValueExpr{
    						Key:   ast.NewIdent("IP"),
    						Value: e,
    					}
    				case 1:
    					if elit, ok := e.(*ast.BasicLit); ok && elit.Value == "0" {
    						cl.Elts = append(cl.Elts[:i], cl.Elts[i+1:]...)
    					} else {
    						cl.Elts[i] = &ast.KeyValueExpr{
    							Key:   ast.NewIdent("Port"),
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 1.3K bytes
    - Viewed (0)
  2. src/cmd/fix/printerconfig.go

    		}
    
    		if ss := se.Sel.String(); ss == "Config" {
    			for i, e := range cl.Elts {
    				if _, ok := e.(*ast.KeyValueExpr); ok {
    					break
    				}
    				switch i {
    				case 0:
    					cl.Elts[i] = &ast.KeyValueExpr{
    						Key:   ast.NewIdent("Mode"),
    						Value: e,
    					}
    				case 1:
    					cl.Elts[i] = &ast.KeyValueExpr{
    						Key:   ast.NewIdent("Tabwidth"),
    						Value: e,
    					}
    				}
    				fixed = true
    			}
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 1.1K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/syntax/issues_test.go

    		want := colbase + uint(i)
    
    		f, err := Parse(nil, strings.NewReader(src), nil, nil, 0)
    		if err != nil {
    			t.Errorf("%s: %v", src, err)
    			continue
    		}
    
    		// locate KeyValueExpr
    		Inspect(f, func(n Node) bool {
    			_, ok := n.(*KeyValueExpr)
    			if ok {
    				if got := StartPos(n).Col(); got != want {
    					t.Errorf("%s: got col = %d, want %d", src, got, want)
    				}
    			}
    			return !ok
    		})
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 17:49:19 UTC 2024
    - 1.2K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/syntax/positions.go

    		// 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
    		case *IndexExpr:
    			m = n.X
    		// case *SliceExpr:
    		case *AssertExpr:
    			m = n.X
    		case *TypeSwitchGuard:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 17:49:19 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/syntax/nodes_test.go

    	{"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`},
    	{"IndexExpr", `a@[i]`},
    
    	{"SliceExpr", `a@[:]`},
    	{"SliceExpr", `a@[i:]`},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Nov 02 18:45:06 UTC 2023
    - 8.7K bytes
    - Viewed (0)
  6. src/go/types/expr.go

    			// (e.g., a duplicate field error doesn't need the struct type).
    			fields := utyp.fields
    			if _, ok := e.Elts[0].(*ast.KeyValueExpr); ok {
    				// all elements must have keys
    				visited := make([]bool, len(fields))
    				for _, e := range e.Elts {
    					kv, _ := e.(*ast.KeyValueExpr)
    					if kv == nil {
    						check.error(e, MixedStructLit, "mixture of field:value and value elements in struct literal")
    						continue
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 02:09:54 UTC 2024
    - 49.7K bytes
    - Viewed (0)
  7. src/go/types/exprstring.go

    	// operator precedences. (This assumes that the AST was
    	// generated by a Go parser.)
    
    	switch x := x.(type) {
    	default:
    		fmt.Fprintf(buf, "(ast: %T)", x) // nil, ast.BadExpr, ast.KeyValueExpr
    
    	case *ast.Ident:
    		buf.WriteString(x.Name)
    
    	case *ast.Ellipsis:
    		buf.WriteString("...")
    		if x.Elt != nil {
    			WriteExpr(buf, x.Elt)
    		}
    
    	case *ast.BasicLit:
    		buf.WriteString(x.Value)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 08 19:31:44 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/composite/composite.go

    			allKeyValue := true
    			var suggestedFixAvailable = len(cl.Elts) == strct.NumFields()
    			var missingKeys []analysis.TextEdit
    			for i, e := range cl.Elts {
    				if _, ok := e.(*ast.KeyValueExpr); !ok {
    					allKeyValue = false
    					if i >= strct.NumFields() {
    						break
    					}
    					field := strct.Field(i)
    					if !field.Exported() {
    						// Adding unexported field names for structs not defined
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 4.4K bytes
    - Viewed (0)
  9. src/go/ast/ast.go

    		X     Expr        // left operand
    		OpPos token.Pos   // position of Op
    		Op    token.Token // operator
    		Y     Expr        // right operand
    	}
    
    	// A KeyValueExpr node represents (key : value) pairs
    	// in composite literals.
    	//
    	KeyValueExpr struct {
    		Key   Expr
    		Colon token.Pos // position of ":"
    		Value Expr
    	}
    )
    
    // The direction of a channel type is indicated by a bit
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 28 21:32:41 UTC 2024
    - 35.6K bytes
    - Viewed (0)
  10. src/cmd/gofmt/simplify.go

    				ktyp = reflect.ValueOf(keyType)
    			}
    			typ := reflect.ValueOf(eltType)
    			for i, x := range outer.Elts {
    				px := &outer.Elts[i]
    				// look at value of indexed/named elements
    				if t, ok := x.(*ast.KeyValueExpr); ok {
    					if keyType != nil {
    						s.simplifyLiteral(ktyp, keyType, t.Key, &t.Key)
    					}
    					x = t.Value
    					px = &t.Value
    				}
    				s.simplifyLiteral(typ, eltType, x, px)
    			}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 19 20:06:14 UTC 2022
    - 4.8K bytes
    - Viewed (0)
Back to top