Documentation
¶
Overview ¶
Package checker resolves names, infers local declaration types, validates assignments/returns, and records a type for every portable expression.
Index ¶
- type CaseBinding
- type CaseNarrowing
- type CasePattern
- type Checker
- type CodecApplication
- type CodecField
- type CodecRawValue
- type CodecSchema
- type EnumCall
- type EnumField
- type EnumVariant
- type GenericApplication
- type NativeResultBridge
- type Options
- type RawEnum
- type RawEnumValue
- type Result
- type ResultCatch
- type ResultTry
- type StructuredBlock
- type TypeAlias
- type UnionMemberAccess
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CaseBinding ¶
type CaseNarrowing ¶ added in v0.2.3
type CasePattern ¶
type CasePattern struct {
Variant EnumVariant
Bindings []CaseBinding
PayloadEnum bool
MatchType types.Type
TypeUnion bool
}
type CodecApplication ¶
type CodecApplication struct {
Operation string
Schema CodecSchema
}
type CodecField ¶
type CodecField struct {
Name string
WireName string
Schema *CodecSchema
}
type CodecRawValue ¶ added in v0.2.1
type CodecSchema ¶
type CodecSchema struct {
Type types.Type
Kind string
Module string
Reference *resolver.Binding
Element *CodecSchema
Fields []CodecField
RawType types.Type
RawValues []CodecRawValue
}
type EnumVariant ¶
type GenericApplication ¶
type NativeResultBridge ¶ added in v0.3.0
type Options ¶ added in v0.1.4
type Options struct {
AllowUnusedImports bool
InteractiveTopLevel bool
RunnableMain *ast.MethodStatement
}
type RawEnum ¶ added in v0.2.1
type RawEnum struct {
Type types.Type
Values map[string]RawEnumValue
}
type RawEnumValue ¶ added in v0.2.1
type Result ¶
type Result struct {
Program *ast.Program
Expressions map[ast.Expression]types.Type
Conversions map[ast.Expression]types.Type
NullableUnwraps map[ast.Expression]types.Type
NativeResultBridges map[ast.Expression]NativeResultBridge
Variables map[*ast.VariableStatement]types.Type
Iterations map[*ast.IterationExpression]types.Type
IterationBindings map[*ast.IterationExpression][]types.Type
LexicalBindings map[*ast.Identifier]bool
Constants map[ast.Expression]string
ConstantOwners map[*ast.VariableStatement]string
Resolution resolver.Result
References map[ast.Expression]resolver.Binding
EnumConstructors map[*ast.CallExpression]EnumVariant
CasePatterns map[ast.Expression]CasePattern
CaseNarrowings map[*ast.CaseStatement]CaseNarrowing
GenericApplications map[*ast.GenericExpression]GenericApplication
CodecApplications map[*ast.CallExpression]CodecApplication
RawEnums map[*ast.EnumStatement]RawEnum
EnumCalls map[*ast.CallExpression]EnumCall
TypeAliases map[*ast.TypeAliasStatement]TypeAlias
ResultTries map[*ast.TryExpression]ResultTry
ResultCatches map[*ast.CatchExpression]ResultCatch
StructuredBlocks map[*ast.CallExpression]StructuredBlock
ExternalMembers map[ast.Expression]declaration.Member
ClassFieldAccesses map[*ast.MemberExpression]bool
UnionMemberAccesses map[*ast.MemberExpression][]UnionMemberAccess
RuntimeDependencies map[string]*stdlib.Package
ImportUses map[*ast.ImportStatement]map[string]bool
}
func Check ¶
func Check(program *ast.Program, resolution resolver.Result) (Result, []diagnostic.Diagnostic)
func CheckWithOptions ¶ added in v0.1.4
func CheckWithOptions(program *ast.Program, resolution resolver.Result, options Options) (Result, []diagnostic.Diagnostic)
type ResultCatch ¶ added in v0.3.0
type ResultCatch struct {
SuccessType types.Type
ErrorType types.Type
ResultType types.Type
HandlerResult ast.Expression
HandlerDiverges bool
}
ResultCatch describes the Result payload and the checked recovery branch of a catch expression. A nil HandlerResult denotes a diverging handler.
type ResultTry ¶ added in v0.3.0
type ResultTry struct {
SuccessType types.Type
ErrorType types.Type
ReturnSuccessType types.Type
ReturnErrorType types.Type
ReturnType types.Type
}
ResultTry describes the two Result variants used by a prefix try expression and the compatible Result boundary that receives its Err payload.
type StructuredBlock ¶ added in v0.2.0
type TypeAlias ¶ added in v0.2.0
type TypeAlias struct {
Target types.Type
Variants []EnumVariant
}
Click to show internal directories.
Click to hide internal directories.