Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for KeyValueExpr (0.23 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. src/cmd/compile/internal/types2/expr.go

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

    		Walk(v, n.Fun)
    		walkList(v, n.Args)
    
    	case *StarExpr:
    		Walk(v, n.X)
    
    	case *UnaryExpr:
    		Walk(v, n.X)
    
    	case *BinaryExpr:
    		Walk(v, n.X)
    		Walk(v, n.Y)
    
    	case *KeyValueExpr:
    		Walk(v, n.Key)
    		Walk(v, n.Value)
    
    	// Types
    	case *ArrayType:
    		if n.Len != nil {
    			Walk(v, n.Len)
    		}
    		Walk(v, n.Elt)
    
    	case *StructType:
    		Walk(v, n.Fields)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 16:34:10 UTC 2024
    - 6.4K bytes
    - Viewed (0)
  9. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock/copylock.go

    	}
    }
    
    // checkCopyLocksCompositeLit detects lock copy inside a composite literal
    func checkCopyLocksCompositeLit(pass *analysis.Pass, cl *ast.CompositeLit) {
    	for _, x := range cl.Elts {
    		if node, ok := x.(*ast.KeyValueExpr); ok {
    			x = node.Value
    		}
    		if path := lockPathRhs(pass, x); path != nil {
    			pass.ReportRangef(x, "literal copies lock value from %v: %v", analysisutil.Format(pass.Fset, x), path)
    		}
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 16:19:04 UTC 2024
    - 9.9K bytes
    - Viewed (0)
  10. src/go/types/index.go

    	visited := make(map[int64]bool, len(elts))
    	var index, max int64
    	for _, e := range elts {
    		// determine and check index
    		validIndex := false
    		eval := e
    		if kv, _ := e.(*ast.KeyValueExpr); kv != nil {
    			if typ, i := check.index(kv.Key, length); isValid(typ) {
    				if i >= 0 {
    					index = i
    					validIndex = true
    				} else {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 22 16:17:05 UTC 2024
    - 11.2K bytes
    - Viewed (0)
Back to top