 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- func SeverityToAnsiString(s Severity) string
- func SeverityToString(s Severity) string
- func TypeToString(r Type) string
- func Unify(t1 Type, t2 Type) (ok bool)
- type AssetMismatch
- type BadAllotmentSum
- type BadArity
- type BuiltinFnHover
- type BuiltinFnHoverContext
- type CheckResult
- func (r CheckResult) GetErrorsCount() int
- func (r *CheckResult) GetExprType(expr parser.ValueExpr) Type
- func (r *CheckResult) GetSymbols() []DocumentSymbol
- func (r *CheckResult) GetVarDeclType(decl parser.VarDeclaration) Type
- func (r CheckResult) GetWarningsCount() int
- func (r CheckResult) ResolveBuiltinFn(v *parser.FnCallIdentifier) FnCallResolution
- func (r CheckResult) ResolveVar(v *parser.Variable) *parser.VarDeclaration
 
- type Diagnostic
- type DiagnosticKind
- type DivByZero
- type DocumentSymbol
- type DocumentSymbolKind
- type DuplicateVariable
- type EmptiedAccount
- type ExperimentalFeature
- type FixedPortionVariable
- type FnCallResolution
- type GotoDefinitionResult
- type Hover
- type InvalidType
- type InvalidUnboundedAccount
- type InvalidWorldOverdraft
- type NoAllotmentInSendAll
- type Parsing
- type RedundantRemaining
- type RemainingIsNotLast
- type Severity
- type StatementFnCallResolution
- type TAsset
- type TVar
- type Type
- type TypeMismatch
- type UnboundVariable
- type UnboundedAccountIsNotLast
- type UnknownFunction
- type UnusedVar
- type VarOriginFnCallResolution
- type VariableHover
- type VersionClause
- type VersionMismatch
Constants ¶
      View Source
      
  
    const FnSetAccountMeta = "set_account_meta"
    
      View Source
      
  
    const FnSetTxMeta = "set_tx_meta"
    
      View Source
      
  
    const FnVarOriginBalance = "balance"
    
      View Source
      
  
    const FnVarOriginGetAmount = "get_amount"
    
      View Source
      
  
    const FnVarOriginGetAsset = "get_asset"
    
      View Source
      
  
    const FnVarOriginMeta = "meta"
    
      View Source
      
  
    const FnVarOriginOverdraft = "overdraft"
    
      View Source
      
  
    const TypeAccount = "account"
    
      View Source
      
  
    const TypeAny = "any"
    
      View Source
      
  
    const TypeAsset = "asset"
    
      View Source
      
  
    const TypeMonetary = "monetary"
    
      View Source
      
  
    const TypeNumber = "number"
    
      View Source
      
  
    const TypePortion = "portion"
    
      View Source
      
  
const TypeString = "string"
    Variables ¶
      View Source
      
  
    var AllowedTypes = []string{ TypeMonetary, TypeAccount, TypePortion, TypeAsset, TypeNumber, TypeString, }
      View Source
      
  
var Builtins = map[string]FnCallResolution{ FnSetTxMeta: StatementFnCallResolution{ Params: []string{TypeString, TypeAny}, Docs: "set transaction metadata", }, FnSetAccountMeta: StatementFnCallResolution{ Params: []string{TypeAccount, TypeString, TypeAny}, Docs: "set account metadata", }, FnVarOriginMeta: VarOriginFnCallResolution{ Params: []string{TypeAccount, TypeString}, Return: TypeAny, Docs: "fetch account metadata", }, FnVarOriginBalance: VarOriginFnCallResolution{ Params: []string{TypeAccount, TypeAsset}, Return: TypeMonetary, Docs: "fetch account balance", }, FnVarOriginOverdraft: VarOriginFnCallResolution{ Params: []string{TypeAccount, TypeAsset}, Return: TypeMonetary, Docs: "get absolute amount of the overdraft of an account. Returns zero if balance is not negative", VersionConstraints: []VersionClause{ { Version: parser.NewVersionInterpreter(0, 0, 15), FeatureFlag: flags.ExperimentalOverdraftFunctionFeatureFlag, }, }, }, FnVarOriginGetAsset: VarOriginFnCallResolution{ Params: []string{TypeMonetary}, Return: TypeAsset, Docs: "get the asset of the given monetary", VersionConstraints: []VersionClause{ { Version: parser.NewVersionInterpreter(0, 0, 16), FeatureFlag: flags.ExperimentalGetAssetFunctionFeatureFlag, }, }, }, FnVarOriginGetAmount: VarOriginFnCallResolution{ Params: []string{TypeMonetary}, Return: TypeNumber, Docs: "get the amount of the given monetary", VersionConstraints: []VersionClause{ { Version: parser.NewVersionInterpreter(0, 0, 16), FeatureFlag: flags.ExperimentalGetAmountFunctionFeatureFlag, }, }, }, }
Functions ¶
func SeverityToAnsiString ¶
func SeverityToString ¶ added in v0.0.20
func TypeToString ¶ added in v0.0.20
Types ¶
type AssetMismatch ¶ added in v0.0.20
func (AssetMismatch) Message ¶ added in v0.0.20
func (e AssetMismatch) Message() string
func (AssetMismatch) Severity ¶ added in v0.0.20
func (AssetMismatch) Severity() Severity
type BadAllotmentSum ¶
func (BadAllotmentSum) Message ¶
func (e BadAllotmentSum) Message() string
func (BadAllotmentSum) Severity ¶
func (BadAllotmentSum) Severity() Severity
type BuiltinFnHover ¶
type BuiltinFnHover struct {
	Range   parser.Range
	Node    *parser.FnCall
	Context BuiltinFnHoverContext
}
    type BuiltinFnHoverContext ¶
type BuiltinFnHoverContext = uint
const ( OriginContext BuiltinFnHoverContext = iota StatementContext )
type CheckResult ¶
type CheckResult struct {
	DeclaredVars map[string]parser.VarDeclaration
	Diagnostics []Diagnostic
	Program     parser.Program
	// contains filtered or unexported fields
}
    func CheckProgram ¶
func CheckProgram(program parser.Program) CheckResult
func CheckSource ¶
func CheckSource(source string) CheckResult
func (CheckResult) GetErrorsCount ¶
func (r CheckResult) GetErrorsCount() int
func (*CheckResult) GetExprType ¶ added in v0.0.20
func (r *CheckResult) GetExprType(expr parser.ValueExpr) Type
func (*CheckResult) GetSymbols ¶
func (r *CheckResult) GetSymbols() []DocumentSymbol
results are sorted by start position
func (*CheckResult) GetVarDeclType ¶ added in v0.0.20
func (r *CheckResult) GetVarDeclType(decl parser.VarDeclaration) Type
func (CheckResult) GetWarningsCount ¶
func (r CheckResult) GetWarningsCount() int
func (CheckResult) ResolveBuiltinFn ¶
func (r CheckResult) ResolveBuiltinFn(v *parser.FnCallIdentifier) FnCallResolution
func (CheckResult) ResolveVar ¶
func (r CheckResult) ResolveVar(v *parser.Variable) *parser.VarDeclaration
type Diagnostic ¶
type Diagnostic struct {
	Range parser.Range
	Kind  DiagnosticKind
	Id    int32
}
    type DiagnosticKind ¶
type DocumentSymbol ¶
type DocumentSymbolKind ¶
type DocumentSymbolKind = float64
const (
	DocumentSymbolVariable DocumentSymbolKind = 13
)
    !important! keep in sync with https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentSymbol
type DuplicateVariable ¶
type DuplicateVariable struct {
	Name string
}
    func (DuplicateVariable) Message ¶
func (e DuplicateVariable) Message() string
func (DuplicateVariable) Severity ¶
func (DuplicateVariable) Severity() Severity
type EmptiedAccount ¶
type EmptiedAccount struct {
	Name string
}
    func (EmptiedAccount) Message ¶
func (e EmptiedAccount) Message() string
func (EmptiedAccount) Severity ¶
func (EmptiedAccount) Severity() Severity
type ExperimentalFeature ¶ added in v0.0.16
type ExperimentalFeature struct {
	Name string
}
    func (ExperimentalFeature) Message ¶ added in v0.0.16
func (e ExperimentalFeature) Message() string
func (ExperimentalFeature) Severity ¶ added in v0.0.16
func (ExperimentalFeature) Severity() Severity
type FixedPortionVariable ¶
func (FixedPortionVariable) Message ¶
func (e FixedPortionVariable) Message() string
func (FixedPortionVariable) Severity ¶
func (FixedPortionVariable) Severity() Severity
type FnCallResolution ¶
type GotoDefinitionResult ¶
func GotoDefinition ¶
func GotoDefinition(program parser.Program, position parser.Position, checkResult CheckResult) *GotoDefinitionResult
type InvalidType ¶
type InvalidType struct {
	Name string
}
    func (InvalidType) Message ¶
func (e InvalidType) Message() string
TODO evaluate suggestion using Levenshtein distance
func (InvalidType) Severity ¶
func (InvalidType) Severity() Severity
type InvalidUnboundedAccount ¶
type InvalidUnboundedAccount struct{}
    func (InvalidUnboundedAccount) Message ¶
func (e InvalidUnboundedAccount) Message() string
func (InvalidUnboundedAccount) Severity ¶
func (InvalidUnboundedAccount) Severity() Severity
type InvalidWorldOverdraft ¶
type InvalidWorldOverdraft struct{}
    func (InvalidWorldOverdraft) Message ¶
func (e InvalidWorldOverdraft) Message() string
func (InvalidWorldOverdraft) Severity ¶
func (InvalidWorldOverdraft) Severity() Severity
type NoAllotmentInSendAll ¶
type NoAllotmentInSendAll struct{}
    func (NoAllotmentInSendAll) Message ¶
func (e NoAllotmentInSendAll) Message() string
func (NoAllotmentInSendAll) Severity ¶
func (NoAllotmentInSendAll) Severity() Severity
type RedundantRemaining ¶
type RedundantRemaining struct{}
    func (RedundantRemaining) Message ¶
func (e RedundantRemaining) Message() string
func (RedundantRemaining) Severity ¶
func (RedundantRemaining) Severity() Severity
type RemainingIsNotLast ¶
type RemainingIsNotLast struct{}
    func (RemainingIsNotLast) Message ¶
func (e RemainingIsNotLast) Message() string
func (RemainingIsNotLast) Severity ¶
func (RemainingIsNotLast) Severity() Severity
type Severity ¶
type Severity = byte
const ( ErrorSeverity Severity WarningSeverity Information Hint )
!important! keep in sync with LSP specs https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticSeverity
type StatementFnCallResolution ¶
func (StatementFnCallResolution) ContextName ¶
func (StatementFnCallResolution) ContextName() string
func (StatementFnCallResolution) GetParams ¶
func (r StatementFnCallResolution) GetParams() []string
type TypeMismatch ¶
func (TypeMismatch) Message ¶
func (e TypeMismatch) Message() string
func (TypeMismatch) Severity ¶
func (TypeMismatch) Severity() Severity
type UnboundVariable ¶
func (UnboundVariable) Message ¶
func (e UnboundVariable) Message() string
TODO evaluate suggestion using Levenshtein distance
func (UnboundVariable) Severity ¶
func (UnboundVariable) Severity() Severity
type UnboundedAccountIsNotLast ¶
type UnboundedAccountIsNotLast struct{}
    func (UnboundedAccountIsNotLast) Message ¶
func (e UnboundedAccountIsNotLast) Message() string
func (UnboundedAccountIsNotLast) Severity ¶
func (UnboundedAccountIsNotLast) Severity() Severity
type UnknownFunction ¶
type UnknownFunction struct {
	Name string
}
    func (UnknownFunction) Message ¶
func (e UnknownFunction) Message() string
func (UnknownFunction) Severity ¶
func (UnknownFunction) Severity() Severity
type VarOriginFnCallResolution ¶
type VarOriginFnCallResolution struct {
	Params             []string
	Docs               string
	Return             string
	VersionConstraints []VersionClause
}
    func (VarOriginFnCallResolution) ContextName ¶
func (VarOriginFnCallResolution) ContextName() string
func (VarOriginFnCallResolution) GetParams ¶
func (r VarOriginFnCallResolution) GetParams() []string
type VersionClause ¶ added in v0.0.16
type VersionClause struct {
	Version     parser.Version
	FeatureFlag flags.FeatureFlag
}
    type VersionMismatch ¶ added in v0.0.16
func (VersionMismatch) Message ¶ added in v0.0.16
func (e VersionMismatch) Message() string
func (VersionMismatch) Severity ¶ added in v0.0.16
func (VersionMismatch) Severity() Severity
 Click to show internal directories. 
   Click to hide internal directories.