Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 15 of 15 for GenDecl (0.12 sec)

  1. src/go/build/read.go

    	if info.parseErr != nil {
    		return nil
    	}
    
    	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
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  2. src/go/types/generate_test.go

    // insertImportPath inserts the given import path.
    // There must be at least one import declaration present already.
    func insertImportPath(f *ast.File, path string) {
    	for _, d := range f.Decls {
    		if g, _ := d.(*ast.GenDecl); g != nil && g.Tok == token.IMPORT {
    			g.Specs = append(g.Specs, &ast.ImportSpec{Path: &ast.BasicLit{ValuePos: g.End(), Kind: token.STRING, Value: path}})
    			return
    		}
    	}
    	panic("no import declaration present")
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 16.5K bytes
    - Viewed (0)
  3. src/go/types/decl.go

    	for _, d := range decls {
    		check.walkDecl(d, f)
    	}
    }
    
    func (check *Checker) walkDecl(d ast.Decl, f func(decl)) {
    	switch d := d.(type) {
    	case *ast.BadDecl:
    		// ignore
    	case *ast.GenDecl:
    		var last *ast.ValueSpec // last ValueSpec with type or init exprs seen
    		for iota, s := range d.Specs {
    			switch s := s.(type) {
    			case *ast.ImportSpec:
    				f(importDecl{s})
    			case *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)
  4. src/go/types/api_test.go

    	if err != nil {
    		t.Fatal(err)
    	}
    
    	// map import paths to importDecl
    	imports := make(map[string]*ast.ImportSpec)
    	for _, s := range f.Decls[0].(*ast.GenDecl).Specs {
    		if imp, _ := s.(*ast.ImportSpec); imp != nil {
    			imports[imp.Path.Value] = imp
    		}
    	}
    
    	for _, test := range tests {
    		imp := imports[test.path]
    		if imp == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 94.2K bytes
    - Viewed (0)
  5. src/cmd/cgo/gcc.go

    	case *ast.FuncType, *ast.InterfaceType, *ast.MapType, *ast.ChanType:
    		return true
    	case *ast.Ident:
    		// TODO: Handle types defined within function.
    		for _, d := range p.Decl {
    			gd, ok := d.(*ast.GenDecl)
    			if !ok || gd.Tok != token.TYPE {
    				continue
    			}
    			for _, spec := range gd.Specs {
    				ts, ok := spec.(*ast.TypeSpec)
    				if !ok {
    					continue
    				}
    				if ts.Name.Name == t.Name {
    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