Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for NewIdent (0.2 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/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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. src/cmd/cgo/out.go

    		err := &ast.Field{Type: ast.NewIdent("error")}
    		l := gtype.Results.List
    		if len(l) == 0 {
    			l = []*ast.Field{err}
    		} else {
    			l = []*ast.Field{l[0], err}
    		}
    		t := new(ast.FuncType)
    		*t = *gtype
    		t.Results = &ast.FieldList{List: l}
    		gtype = t
    	}
    
    	// Go func declaration.
    	d := &ast.FuncDecl{
    		Name: ast.NewIdent(n.Mangle),
    		Type: gtype,
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 29 16:41:10 UTC 2024
    - 59.6K bytes
    - Viewed (0)
  9. src/go/ast/filter.go

    		i := 0
    		for _, filename := range filenames {
    			f := pkg.Files[filename]
    			i += copy(comments[i:], f.Comments)
    		}
    	}
    
    	// TODO(gri) need to compute unresolved identifiers!
    	return &File{doc, pos, NewIdent(pkg.Name), decls, minPos, maxPos, pkg.Scope, imports, nil, comments, ""}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  10. src/go/ast/ast.go

    func (*ChanType) exprNode()      {}
    
    // ----------------------------------------------------------------------------
    // Convenience functions for Idents
    
    // NewIdent creates a new [Ident] without position.
    // Useful for ASTs generated by code other than the Go parser.
    func NewIdent(name string) *Ident { return &Ident{token.NoPos, name, nil} }
    
    // IsExported reports whether name starts with an upper-case letter.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 28 21:32:41 UTC 2024
    - 35.6K bytes
    - Viewed (0)
Back to top