Documentation ¶
Overview ¶
DEPRECATED PACKAGE - SEE go/types INSTEAD. This package implements typechecking of a Go AST. The result of the typecheck is an augmented AST with object and type information for each identifier.
Index ¶
Constants ¶
const ( Bool = iota Byte Uint Int Float Complex Uintptr String Uint8 Uint16 Uint32 Uint64 Int8 Int16 Int32 Int64 Float32 Float64 Complex64 Complex128 )
The list of basic type id's.
Variables ¶
var BasicTypes = map[uint]string{ Bool: "bool", Byte: "byte", Uint: "uint", Int: "int", Float: "float", Complex: "complex", Uintptr: "uintptr", String: "string", Uint8: "uint8", Uint16: "uint16", Uint32: "uint32", Uint64: "uint64", Int8: "int8", Int16: "int16", Int32: "int32", Int64: "int64", Float32: "float32", Float64: "float64", Complex64: "complex64", Complex128: "complex128", }
var Universe *ast.Scope
The Universe scope contains all predeclared identifiers.
Functions ¶
func CheckFile ¶
CheckFile typechecks a single file, but otherwise behaves like CheckPackage. If the complete package consists of more than just one file, the file may not typecheck without errors.
func CheckPackage ¶
CheckPackage typechecks a package and augments the AST by setting *ast.Object, *ast.Type, and *ast.Scope fields accordingly. If an importer is provided, it is used to handle imports, otherwise they are ignored (likely leading to typechecking errors).
If errors are reported, the AST may be incompletely augmented (fields may be nil) or contain incomplete object, type, or scope information.
Types ¶
type Form ¶
type Form int
Form describes the form of a type.
type Importer ¶
An importer takes an import path and returns the data describing the respective package's exported interface. The data format is TBD.
type Type ¶
type Type struct { Form Form Obj *ast.Object // corresponding type name, or nil Scope *ast.Scope // fields and methods, always present N uint // basic type id, array length, number of function results, or channel direction Key, Elt *Type // map key and array, pointer, slice, map or channel element Params *ast.Scope // function (receiver, input and result) parameters, tuple expressions (results of function calls), or nil Expr ast.Expr // corresponding AST expression }
A Type represents a Go type.