Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for importSpec (0.14 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/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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. src/go/build/read.go

    	}
    
    	hasEmbed := false
    	for _, decl := range info.parsed.Decls {
    		d, ok := decl.(*ast.GenDecl)
    		if !ok {
    			continue
    		}
    		for _, dspec := range d.Specs {
    			spec, ok := dspec.(*ast.ImportSpec)
    			if !ok {
    				continue
    			}
    			quoted := spec.Path.Value
    			path, err := strconv.Unquote(quoted)
    			if err != nil {
    				return fmt.Errorf("parser returned invalid quoted string: <%s>", quoted)
    			}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  10. src/go/doc/reader.go

    		switch d := decl.(type) {
    		case *ast.GenDecl:
    			switch d.Tok {
    			case token.IMPORT:
    				// imports are handled individually
    				for _, spec := range d.Specs {
    					if s, ok := spec.(*ast.ImportSpec); ok {
    						if import_, err := strconv.Unquote(s.Path.Value); err == nil {
    							r.imports[import_] = 1
    							var name string
    							if s.Name != nil {
    								name = s.Name.Name
    								if name == "." {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 27.5K bytes
    - Viewed (0)
Back to top