github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/src/cmd/vet/typestub.go (about)

     1  // Copyright 2010 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build !gotypes
     6  
     7  // This file contains stubs for the pieces of the tool that require the go/types package,
     8  // to be used if go/types is not available.
     9  
    10  package main
    11  
    12  import (
    13  	"go/ast"
    14  	"go/token"
    15  )
    16  
    17  // Type is equivalent to go/types.Type. Repeating it here allows us to avoid
    18  // depending on the go/types package.
    19  type Type interface {
    20  	String() string
    21  }
    22  
    23  func (pkg *Package) check(fs *token.FileSet, astFiles []*ast.File) error {
    24  	return nil
    25  }
    26  
    27  func (pkg *Package) isStruct(c *ast.CompositeLit) (bool, string) {
    28  	return true, "" // Assume true, so we do the check.
    29  }
    30  
    31  func (f *File) matchArgType(t printfArgType, arg ast.Expr) bool {
    32  	return true // We can't tell without types.
    33  }
    34  
    35  func (f *File) numArgsInSignature(call *ast.CallExpr) int {
    36  	return 0 // We don't know.
    37  }
    38  
    39  func (f *File) isErrorMethodCall(call *ast.CallExpr) bool {
    40  	// Is it a selector expression? Otherwise it's a function call, not a method call.
    41  	if _, ok := call.Fun.(*ast.SelectorExpr); !ok {
    42  		return false
    43  	}
    44  	return true // Best guess we can make without types.
    45  }