Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 19 for NewIdent (0.12 sec)

  1. src/go/types/generate_test.go

    // isIdent reports whether x is an identifier with the given name.
    func isIdent(x ast.Node, name string) bool {
    	return asIdent(x, name) != nil
    }
    
    // newIdent returns a new identifier with the given position and name.
    func newIdent(pos token.Pos, name string) *ast.Ident {
    	id := ast.NewIdent(name)
    	id.NamePos = pos
    	return id
    }
    
    // insert inserts x at list[at] and moves the remaining elements up.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 16.5K bytes
    - Viewed (0)
  2. src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go

    					pkgName = cand.Name.Name
    				}
    			}
    		}
    		if pkgName == "." {
    			return ast.NewIdent(t.Obj().Name())
    		}
    		return &ast.SelectorExpr{
    			X:   ast.NewIdent(pkgName),
    			Sel: ast.NewIdent(t.Obj().Name()),
    		}
    	case *types.Struct:
    		return ast.NewIdent(t.String())
    	case *types.Interface:
    		return ast.NewIdent(t.String())
    	default:
    		return nil
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 16:19:04 UTC 2024
    - 11.7K bytes
    - Viewed (0)
  3. src/cmd/fix/printerconfig.go

    				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
    			}
    		}
    	})
    	return fixed
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 1.1K bytes
    - Viewed (0)
  4. src/cmd/fix/netipv6zone.go

    				}
    				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"),
    							Value: e,
    						}
    					}
    				}
    				fixed = true
    			}
    		}
    	})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 1.3K bytes
    - Viewed (0)
  5. src/go/doc/exports.go

    func filterIdentList(list []*ast.Ident) []*ast.Ident {
    	j := 0
    	for _, x := range list {
    		if token.IsExported(x.Name) {
    			list[j] = x
    			j++
    		}
    	}
    	return list[0:j]
    }
    
    var underscore = ast.NewIdent("_")
    
    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
    	}
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 01 18:18:07 UTC 2022
    - 8.5K bytes
    - Viewed (0)
  6. src/go/doc/example.go

    			// Copy the FuncDecl, as it may be used elsewhere.
    			newF := *f
    			newF.Name = ast.NewIdent("main")
    			newF.Body, comments = stripOutputComment(f.Body, comments)
    			d = &newF
    		}
    		decls = append(decls, d)
    	}
    
    	// Copy the File, as it may be used elsewhere.
    	f := *file
    	f.Name = ast.NewIdent("main")
    	f.Decls = decls
    	f.Comments = comments
    	return &f
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 21.4K bytes
    - Viewed (0)
  7. src/go/doc/reader.go

    	origPos := newField.Type.Pos()
    	_, origRecvIsPtr := newField.Type.(*ast.StarExpr)
    	newIdent := &ast.Ident{NamePos: origPos, Name: recvTypeName}
    	var typ ast.Expr = newIdent
    	if !embeddedIsPtr && origRecvIsPtr {
    		newIdent.NamePos++ // '*' is one character
    		typ = &ast.StarExpr{Star: origPos, X: newIdent}
    	}
    	newField.Type = typ
    
    	// copy existing receiver field list and set new receiver field
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 27.5K bytes
    - Viewed (0)
  8. cmd/preferredimports/preferredimports.go

    							a.failed = true
    						}
    						replacements[importName] = alias
    						if imp.Name != nil {
    							imp.Name.Name = alias
    						} else {
    							imp.Name = ast.NewIdent(alias)
    						}
    					}
    					break
    				}
    			}
    
    			if len(replacements) > 0 {
    				if *confirm {
    					fmt.Printf("%sReplacing imports with aliases in file %s\n", logPrefix, pathToFile)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Mar 01 06:06:44 UTC 2024
    - 7.1K bytes
    - Viewed (0)
  9. src/go/types/struct.go

    			pos := f.Type.Pos() // position of type, for errors
    			name := embeddedFieldIdent(f.Type)
    			if name == nil {
    				check.errorf(f.Type, InvalidSyntaxTree, "embedded field type %s has no name", f.Type)
    				name = ast.NewIdent("_")
    				name.NamePos = pos
    				addInvalid(name)
    				continue
    			}
    			add(name, true) // struct{p.T} field has position of T
    
    			// Because we have a name, typ must be of the form T or *T, where T is the name
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 29 22:06:18 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  10. src/cmd/cgo/gcc.go

    	getNewIdent := ast.NewIdent
    	if addPosition {
    		getNewIdent = func(newName string) *ast.Ident {
    			mangledIdent := ast.NewIdent(newName)
    			if len(newName) == len(r.Name.Go) {
    				return mangledIdent
    			}
    			p := fset.Position((*r.Expr).End())
    			if p.Column == 0 {
    				return mangledIdent
    			}
    			return ast.NewIdent(fmt.Sprintf("%s /*line :%d:%d*/", newName, p.Line, p.Column))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 15:50:06 UTC 2024
    - 97K bytes
    - Viewed (0)
Back to top