yi-mode-javascript-0.19.1: Yi editor javascript mode

Safe Haskell | None
Language | Haskell2010

Yi.Verifier.JavaScript

Contents

- Types
- Instances
- Main code
- Helper functions
- Misc

Synopsis

- data Error = MultipleFunctionDeclaration String [Posn]
- data Warning = UnreachableCode Posn
- data Report
  - = Err Error
  - | Warn Warning
- verify :: Tree TT -> Writer (DList Report) ()
- checkMultipleFuns :: [Statement TT] -> Writer (DList Report) ()
- checkUnreachable :: [Statement TT] -> Writer (DList Report) ()
- ttEq :: Eq t => Tok t -> Tok t -> Bool
- say :: MonadWriter (DList a) m => a -> m ()
- isReturn :: Statement t -> Bool
- findFunctions :: [Statement t] -> [Statement t]
- funName :: Statement t -> t
- funBody :: Statement t -> [Statement t]
- nameOf :: Token -> String
- dropWhile' :: (a -> Bool) -> [a] -> [a]
- dupsBy :: (a -> a -> Bool) -> [a] -> [a]

# Types

data Error Source #

Constructors

MultipleFunctionDeclaration String [Posn] |

#### Instances

Instances details

Show Error Source # |
Instance details Defined in Yi.Verifier.JavaScript Methods showsPrec :: Int -> Error -> ShowS Source # show :: Error -> String Source # showList :: [Error] -> ShowS Source #
Eq Error Source # |
Instance details Defined in Yi.Verifier.JavaScript Methods (==) :: Error -> Error -> Bool Source # (/=) :: Error -> Error -> Bool Source #

data Warning Source #

Constructors

UnreachableCode Posn |

#### Instances

Instances details

Show Warning Source # |
Instance details Defined in Yi.Verifier.JavaScript Methods showsPrec :: Int -> Warning -> ShowS Source # show :: Warning -> String Source # showList :: [Warning] -> ShowS Source #
Eq Warning Source # |
Instance details Defined in Yi.Verifier.JavaScript Methods (==) :: Warning -> Warning -> Bool Source # (/=) :: Warning -> Warning -> Bool Source #

data Report Source #

Constructors

Err Error |
Warn Warning |

#### Instances

Instances details

Show Report Source # |
Instance details Defined in Yi.Verifier.JavaScript Methods showsPrec :: Int -> Report -> ShowS Source # show :: Report -> String Source # showList :: [Report] -> ShowS Source #
Eq Report Source # |
Instance details Defined in Yi.Verifier.JavaScript Methods (==) :: Report -> Report -> Bool Source # (/=) :: Report -> Report -> Bool Source #

# Instances

# Main code

verify :: Tree TT -> Writer (DList Report) () Source #

The main verifier which calls the sub-verifiers.

checkMultipleFuns :: [Statement TT] -> Writer (DList Report) () Source #

Given a list of function declarations, checks for multiple function declarations, including the functions' subfunctions.

checkUnreachable :: [Statement TT] -> Writer (DList Report) () Source #

# Helper functions

ttEq :: Eq t => Tok t -> Tok t -> Bool Source #

Given two `Tok t`, compares the `t`s.

say :: MonadWriter (DList a) m => a -> m () Source #

isReturn :: Statement t -> Bool Source #

findFunctions :: [Statement t] -> [Statement t] Source #

Returns a list of the functions in the given block.

funName :: Statement t -> t Source #

Given a `FunDecl`, returns the token representing the name.

funBody :: Statement t -> [Statement t] Source #

Given a `FunDecl`, returns its inner body as a list.

nameOf :: Token -> String Source #

Given a `ValidName` returns the string representing the name.

# Misc

dropWhile' :: (a -> Bool) -> [a] -> [a] Source #

Like `dropWhile` but drops the first element in the result.

dupsBy :: (a -> a -> Bool) -> [a] -> [a] Source #