swarm-0.3.0.1: 2D resource gathering game with programmable robots
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.Language.LSP.VarUsage

Synopsis

Documentation

data BindingType Source #

Constructors

Lambda 
Let 
Bind 

Instances

Instances details
Show BindingType Source # 
Instance details

Defined in Swarm.Language.LSP.VarUsage

Eq BindingType Source # 
Instance details

Defined in Swarm.Language.LSP.VarUsage

data Usage Source #

Constructors

Usage 

Fields

Instances

Instances details
Monoid Usage Source # 
Instance details

Defined in Swarm.Language.LSP.VarUsage

Methods

mempty :: Usage #

mappend :: Usage -> Usage -> Usage #

mconcat :: [Usage] -> Usage #

Semigroup Usage Source # 
Instance details

Defined in Swarm.Language.LSP.VarUsage

Methods

(<>) :: Usage -> Usage -> Usage #

sconcat :: NonEmpty Usage -> Usage #

stimes :: Integral b => b -> Usage -> Usage #

checkOccurrences :: BindingSites -> LocVar -> BindingType -> [Syntax] -> Usage Source #

Descends the syntax tree rooted at a variable declaration, accumulating variable references. Generates a "problem" if an associated variable reference is not encountered in the subtree for this declaration.

getUsage :: BindingSites -> Syntax -> Usage Source #

Build up the bindings map as a function argument as we descend into the syntax tree. Aggregates unused bindings as we return from each layer.