typechecker

package
v0.0.0-...-b42b9c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: BSD-3-Clause, GooglePatentClause, MIT Imports: 6 Imported by: 0

Documentation

Overview

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

This section is empty.

Variables

View Source
var Universe *ast.Scope

The Universe scope contains all predeclared identifiers.

Functions

func CheckFile

func CheckFile(file *ast.File, importer Importer) os.Error

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

func CheckPackage(pkg *ast.Package, importer Importer) os.Error

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 Importer

type Importer func(path string) ([]byte, os.Error)

An importer takes an import path and returns the data describing the respective package's exported interface. The data format is TBD.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL