Documentation ¶
Index ¶
- func AsError(report Report) error
- type AlreadyDeclaredError
- type BaseReport
- type Diagnostic
- type Emitter
- type ExpectedCtorError
- type ExpectedUnionError
- type ExportError
- type ImportError
- type ModuleNotImportedError
- type Region
- type RepeatedCtorError
- type RepeatedFieldError
- type RepeatedVarTypeError
- type Report
- type ReportType
- type Reporter
- type UndefinedError
- type UndefinedTypeVarError
- type UnexpectedTokenError
- type UnresolvedNameError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlreadyDeclaredError ¶
type AlreadyDeclaredError struct { BaseReport Name string }
func NewAlreadyDeclaredError ¶
func NewAlreadyDeclaredError(decl ast.Decl, name *ast.Ident) *AlreadyDeclaredError
func (*AlreadyDeclaredError) Message ¶
func (e *AlreadyDeclaredError) Message() string
type BaseReport ¶
type BaseReport struct {
// contains filtered or unexported fields
}
func NewBaseReport ¶
func NewBaseReport(typ ReportType, pos token.Pos, msg string, region *Region) BaseReport
func (BaseReport) Message ¶
func (r BaseReport) Message() string
func (BaseReport) Pos ¶
func (r BaseReport) Pos() token.Pos
func (BaseReport) Region ¶
func (r BaseReport) Region() *Region
func (BaseReport) Type ¶
func (r BaseReport) Type() ReportType
type Diagnostic ¶
type Emitter ¶
type Emitter interface { // Emit emits the given reports for the given file. Emit(string, []*Diagnostic) error }
Emitter emits reports to the user.
type ExpectedCtorError ¶
type ExpectedCtorError struct { BaseReport Name string ActualKind ast.ObjKind }
func NewExpectedCtorError ¶
func NewExpectedCtorError(decl ast.Decl, obj *ast.Object) *ExpectedCtorError
func (*ExpectedCtorError) Message ¶
func (e *ExpectedCtorError) Message() string
type ExpectedUnionError ¶
type ExpectedUnionError struct { BaseReport Name string ActualKind ast.ObjKind }
func NewExpectedUnionError ¶
func NewExpectedUnionError(decl ast.Decl, obj *ast.Object) *ExpectedUnionError
func (*ExpectedUnionError) Message ¶
func (e *ExpectedUnionError) Message() string
type ExportError ¶
type ExportError struct { BaseReport Module string Name string }
func NewExportError ¶
func NewExportError(decl *ast.ModuleDecl, name *ast.Ident) *ExportError
func (*ExportError) Message ¶
func (e *ExportError) Message() string
type ImportError ¶
type ImportError struct { BaseReport Module string Name string }
func NewImportError ¶
type ModuleNotImportedError ¶
type ModuleNotImportedError struct { BaseReport Module string }
func NewModuleNotImportedError ¶
func NewModuleNotImportedError(expr ast.Node, name string) *ModuleNotImportedError
func (ModuleNotImportedError) Message ¶
func (e ModuleNotImportedError) Message() string
type Region ¶
func RegionFromNode ¶
type RepeatedCtorError ¶
type RepeatedCtorError struct { BaseReport Ctor string }
func NewRepeatedCtorError ¶
func NewRepeatedCtorError(decl ast.Decl, name *ast.Ident) *RepeatedCtorError
func (RepeatedCtorError) Message ¶
func (e RepeatedCtorError) Message() string
type RepeatedFieldError ¶
type RepeatedFieldError struct { BaseReport Field string }
func NewRepeatedFieldError ¶
func NewRepeatedFieldError(record ast.Node, field *ast.Ident) *RepeatedFieldError
func (*RepeatedFieldError) Message ¶
func (e *RepeatedFieldError) Message() string
type RepeatedVarTypeError ¶
type RepeatedVarTypeError struct { BaseReport Var string }
func NewRepeatedVarTypeError ¶
func NewRepeatedVarTypeError(decl ast.Decl, name *ast.Ident) *RepeatedVarTypeError
func (RepeatedVarTypeError) Message ¶
func (e RepeatedVarTypeError) Message() string
type Report ¶
type Report interface { Type() ReportType Message() string Pos() token.Pos Region() *Region }
type ReportType ¶
type ReportType byte
const ( OtherError ReportType = iota SyntaxError NameError TypeError Info Warning )
func (ReportType) Color ¶
func (t ReportType) Color() func(string, ...interface{}) string
func (ReportType) String ¶
func (t ReportType) String() string
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter is in charge of reporting the diagnostics occurred during any of the compilation steps to the user.
func NewReporter ¶
NewReporter creates a new reporter.
type UndefinedError ¶
type UndefinedError struct { BaseReport Name string }
func NewUndefinedError ¶
func NewUndefinedError(expr ast.Node, name *ast.Ident) *UndefinedError
func (UndefinedError) Message ¶
func (e UndefinedError) Message() string
type UndefinedTypeVarError ¶
type UndefinedTypeVarError struct { BaseReport Name string }
func NewUndefinedTypeVarError ¶
func NewUndefinedTypeVarError(expr ast.Node, varTyp *ast.VarType) *UndefinedTypeVarError
func (UndefinedTypeVarError) Message ¶
func (e UndefinedTypeVarError) Message() string
type UnexpectedTokenError ¶
type UnexpectedTokenError struct { BaseReport Token *token.Token Expected []token.Type }
func NewUnexpectedTokenError ¶
func (UnexpectedTokenError) Message ¶
func (e UnexpectedTokenError) Message() string
type UnresolvedNameError ¶
type UnresolvedNameError struct { BaseReport Name string }
func NewUnresolvedNameError ¶
func NewUnresolvedNameError(name string, node *ast.Ident) *UnresolvedNameError
func (*UnresolvedNameError) Message ¶
func (e *UnresolvedNameError) Message() string
Click to show internal directories.
Click to hide internal directories.