Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for importSpec (0.23 sec)

  1. src/go/ast/import.go

    }
    
    func importPath(s Spec) string {
    	t, err := strconv.Unquote(s.(*ImportSpec).Path.Value)
    	if err == nil {
    		return t
    	}
    	return ""
    }
    
    func importName(s Spec) string {
    	n := s.(*ImportSpec).Name
    	if n == nil {
    		return ""
    	}
    	return n.Name
    }
    
    func importComment(s Spec) string {
    	c := s.(*ImportSpec).Comment
    	if c == nil {
    		return ""
    	}
    	return c.Text()
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 5.7K bytes
    - Viewed (0)
  2. src/go/doc/example.go

    func findImportGroupStarts(imps []*ast.ImportSpec) []token.Pos {
    	startImps := findImportGroupStarts1(imps)
    	groupStarts := make([]token.Pos, len(startImps))
    	for i, imp := range startImps {
    		groupStarts[i] = imp.Pos()
    	}
    	return groupStarts
    }
    
    // Helper for findImportGroupStarts to ease testing.
    func findImportGroupStarts1(origImps []*ast.ImportSpec) []*ast.ImportSpec {
    	// Copy to avoid mutation.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 21.4K bytes
    - Viewed (0)
  3. src/go/ast/ast.go

    // constant, type, or variable declaration.
    type (
    	// The Spec type stands for any of *ImportSpec, *ValueSpec, and *TypeSpec.
    	Spec interface {
    		Node
    		specNode()
    	}
    
    	// An ImportSpec node represents a single package import.
    	ImportSpec struct {
    		Doc     *CommentGroup // associated documentation; or nil
    		Name    *Ident        // local package name (including "."); or nil
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 28 21:32:41 UTC 2024
    - 35.6K bytes
    - Viewed (0)
  4. src/go/types/generate_test.go

    func renameImportPath(f *ast.File, renames ...string) {
    	m := makeRenameMap(renames...)
    	ast.Inspect(f, func(n ast.Node) bool {
    		switch n := n.(type) {
    		case *ast.ImportSpec:
    			if n.Path.Kind != token.STRING {
    				panic("invalid import path")
    			}
    			m.rename(&n.Path.Value)
    			return false
    		}
    		return true
    	})
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 16.5K bytes
    - Viewed (0)
  5. src/go/ast/scope.go

    func (obj *Object) Pos() token.Pos {
    	name := obj.Name
    	switch d := obj.Decl.(type) {
    	case *Field:
    		for _, n := range d.Names {
    			if n.Name == name {
    				return n.Pos()
    			}
    		}
    	case *ImportSpec:
    		if d.Name != nil && d.Name.Name == name {
    			return d.Name.Pos()
    		}
    		return d.Path.Pos()
    	case *ValueSpec:
    		for _, n := range d.Names {
    			if n.Name == name {
    				return n.Pos()
    			}
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 28 21:32:41 UTC 2024
    - 4.6K bytes
    - Viewed (0)
  6. src/go/types/api.go

    	// Implicits maps nodes to their implicitly declared objects, if any.
    	// The following node and object types may appear:
    	//
    	//     node               declared object
    	//
    	//     *ast.ImportSpec    *PkgName for imports without renames
    	//     *ast.CaseClause    type-specific *Var for each type switch case clause (incl. default)
    	//     *ast.Field         anonymous parameter *Var (incl. unnamed results)
    	//
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 19:57:43 UTC 2024
    - 17.2K bytes
    - Viewed (0)
  7. src/go/ast/walk.go

    	case *RangeStmt:
    		if n.Key != nil {
    			Walk(v, n.Key)
    		}
    		if n.Value != nil {
    			Walk(v, n.Value)
    		}
    		Walk(v, n.X)
    		Walk(v, n.Body)
    
    	// Declarations
    	case *ImportSpec:
    		if n.Doc != nil {
    			Walk(v, n.Doc)
    		}
    		if n.Name != nil {
    			Walk(v, n.Name)
    		}
    		Walk(v, n.Path)
    		if n.Comment != nil {
    			Walk(v, n.Comment)
    		}
    
    	case *ValueSpec:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 16:34:10 UTC 2024
    - 6.4K bytes
    - Viewed (0)
  8. src/go/ast/filter.go

    			for _, d := range decls {
    				if d != nil {
    					decls[i] = d
    					i++
    				}
    			}
    			decls = decls[0:i]
    		}
    	}
    
    	// Collect import specs from all package files.
    	var imports []*ImportSpec
    	if mode&FilterImportDuplicates != 0 {
    		seen := make(map[string]bool)
    		for _, filename := range filenames {
    			f := pkg.Files[filename]
    			for _, imp := range f.Imports {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  9. src/go/types/decl.go

    		if cmpPos(t.Pos(), pos) < 0 {
    			fst, pos = i+1, t.Pos()
    		}
    	}
    	return fst
    }
    
    type (
    	decl interface {
    		node() ast.Node
    	}
    
    	importDecl struct{ spec *ast.ImportSpec }
    	constDecl  struct {
    		spec      *ast.ValueSpec
    		iota      int
    		typ       ast.Expr
    		init      []ast.Expr
    		inherited bool
    	}
    	varDecl  struct{ spec *ast.ValueSpec }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 31K bytes
    - Viewed (0)
  10. src/go/types/api_test.go

    			continue
    		}
    
    		// extract Implicits entry, if any
    		var got string
    		for n, obj := range info.Implicits {
    			switch x := n.(type) {
    			case *ast.ImportSpec:
    				got = "importSpec"
    			case *ast.CaseClause:
    				got = "caseClause"
    			case *ast.Field:
    				got = "field"
    			default:
    				t.Fatalf("package %s: unexpected %T", name, x)
    			}
    			got += ": " + obj.String()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 94.2K bytes
    - Viewed (0)
Back to top