Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for KeyValueExpr (0.23 sec)

  1. 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)
  2. 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)
  3. src/go/printer/nodes.go

    		// generated code - simply ignore the size in this case by setting
    		// it to 0).
    		prevSize := size
    		const infinity = 1e6 // larger than any source line
    		size = p.nodeSize(x, infinity)
    		pair, isPair := x.(*ast.KeyValueExpr)
    		if size <= infinity && prev.IsValid() && next.IsValid() {
    			// x fits on a single line
    			if isPair {
    				size = p.nodeSize(pair.Key, infinity) // size <= infinity
    			}
    		} else {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 17 18:53:17 UTC 2023
    - 52.6K bytes
    - Viewed (0)
  4. src/go/printer/testdata/parser.go

    		return p.parseLiteralValue(nil)
    	}
    
    	x := p.parseExpr(keyOk) // don't resolve if map key
    	if keyOk {
    		if p.tok == token.COLON {
    			colon := p.pos
    			p.next()
    			return &ast.KeyValueExpr{x, colon, p.parseElement(false)}
    		}
    		p.resolve(x) // not a map key
    	}
    
    	return x
    }
    
    func (p *parser) parseElementList() (list []ast.Expr) {
    	if p.trace {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jul 20 20:19:51 UTC 2023
    - 50.5K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/syntax/parser.go

    	p.xnest++
    	p.want(_Lbrace)
    	x.Rbrace = p.list("composite literal", _Comma, _Rbrace, func() bool {
    		// value
    		e := p.bare_complitexpr()
    		if p.tok == _Colon {
    			// key ':' value
    			l := new(KeyValueExpr)
    			l.pos = p.pos()
    			p.next()
    			l.Key = e
    			l.Value = p.bare_complitexpr()
    			e = l
    			x.NKeys++
    		}
    		x.ElemList = append(x.ElemList, e)
    		return false
    	})
    	p.xnest--
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 62.9K bytes
    - Viewed (0)
  6. src/go/parser/parser.go

    func (p *parser) parseElement() ast.Expr {
    	if p.trace {
    		defer un(trace(p, "Element"))
    	}
    
    	x := p.parseValue()
    	if p.tok == token.COLON {
    		colon := p.pos
    		p.next()
    		x = &ast.KeyValueExpr{Key: x, Colon: colon, Value: p.parseValue()}
    	}
    
    	return x
    }
    
    func (p *parser) parseElementList() (list []ast.Expr) {
    	if p.trace {
    		defer un(trace(p, "ElementList"))
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 08 20:07:50 UTC 2023
    - 72.2K bytes
    - Viewed (0)
Back to top