analyzer

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

func NewAnalyzer

func NewAnalyzer(host HostDependencies, scopeAdditions map[string]Variable) Analyzer

func (*Analyzer) Analyze

func (self *Analyzer) Analyze(
	parsedEntryModule pAst.Program,
) (
	modules map[string]ast.AnalyzedProgram,
	diagnostics []diagnostic.Diagnostic,
	syntaxErrors []errors.Error,
)

func (*Analyzer) CheckAny

func (self *Analyzer) CheckAny(typ ast.Type) bool

returns a true if an any type is detected

func (*Analyzer) ConvertType

func (self *Analyzer) ConvertType(oldType pAst.HmsType, createErrors bool) ast.Type

func (*Analyzer) TypeCheck

func (self *Analyzer) TypeCheck(got ast.Type, expected ast.Type, allowFunctionTypes bool) *CompabilityError

type CompabilityError

type CompabilityError struct {
	GotDiagnostic      diagnostic.Diagnostic
	ExpectedDiagnostic *diagnostic.Diagnostic
}

type HostDependencies

type HostDependencies interface {
	GetBuiltinImport(moduleName string, valueName string, span errors.Span) (valueType ast.Type, moduleFound bool, valueFound bool)
	ResolveCodeModule(moduleName string) (code string, moduleFound bool, err error)
}

type Module

type Module struct {
	ImportsModules           []string
	Functions                []*function
	Scopes                   []scope
	CurrentFunction          *function
	LoopDepth                uint // continue and break are legal if > 0
	CurrentLoopIsTerminated  bool // specifies whether there is at least one `break` statement inside the current loop
	CreateErrorIfContainsAny bool // if enabled, every expression which contains `any` will be reported as an error
}

func (Module) Imports

func (self Module) Imports(test string) bool

type Variable

type Variable struct {
	Type   ast.Type
	Span   errors.Span
	Used   bool
	Origin VariableOriginKind
	IsPub  bool
}

func NewBuiltinVar

func NewBuiltinVar(typ ast.Type) Variable

func NewVar

func NewVar(typ ast.Type, span errors.Span, origin VariableOriginKind, isPub bool) Variable

type VariableOriginKind

type VariableOriginKind uint8
const (
	NormalVariableOriginKind VariableOriginKind = iota
	ImportedVariableOriginKind
	BuiltinVariableOriginKind
	ParameterVariableOriginKind
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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