Safe Haskell | None |
---|---|
Language | Haskell2010 |
QuickCheck $Arbitrary$ instances for ECMAScript 3 abstract syntax.
- cshrink :: Arbitrary a => [a] -> [a]
- emptyStmtShrink :: Arbitrary a => a -> [Statement a]
- type LabelSubst = Map (Id ()) (Id ())
- emptyConstantPool :: Map k a
- class Fixable a where
- fixLValue :: LValue a -> LValue a
- fixUpFunExpr :: Data a => Expression a -> Gen (Expression a)
- fixUpListExpr :: Data a => Expression a -> Gen (Expression a)
- fixUpFunStmt :: Data a => Statement a -> Gen (Statement a)
- identifierFixup :: Id a -> Id a
- identifierNameFixup :: String -> String
- fixBreakContinue :: Data a => [Statement a] -> Gen [Statement a]
- rChooseElem :: [a] -> Int -> Gen [a]
- selectRandomElement :: [a] -> Gen a
- isSwitchStmt :: Statement a -> Bool
Documentation
emptyStmtShrink :: Arbitrary a => a -> [Statement a] Source #
emptyConstantPool :: Map k a Source #
class Fixable a where Source #
A class of AST elements that need fixup after generation
Data a => Fixable (Statement a) Source # | |
Data a => Fixable (ForInInit a) Source # | |
Data a => Fixable (ForInit a) Source # | |
Data a => Fixable (VarDecl a) Source # | |
Data a => Fixable (CatchClause a) Source # | |
Data a => Fixable (CaseClause a) Source # | |
Data a => Fixable (Expression a) Source # | |
Data a => Fixable (LValue a) Source # | |
Data a => Fixable (Prop a) Source # | |
Fixable (Id a) Source # | |
Data a => Fixable (JavaScript a) Source # | |
fixUpFunExpr :: Data a => Expression a -> Gen (Expression a) Source #
fixUpListExpr :: Data a => Expression a -> Gen (Expression a) Source #
identifierFixup :: Id a -> Id a Source #
identifierNameFixup :: String -> String Source #
Renames empty identifiers, as well as identifiers that are keywords or future reserved words by prepending a '_' to them. Also substitutes illegal characters with a "_" as well.
fixBreakContinue :: Data a => [Statement a] -> Gen [Statement a] Source #
Fixes an incorrect nesting of break/continue, making the program abide by the ECMAScript spec (page 92): any continue without a label should be nested within an iteration stmt, any continue with a label should be nested in a labeled statement (not necessarily with the same label); any break statement without a label should be nested in an iteration or switch stmt, any break statement with a label should be nested in a labeled statement (not necessarily with the same label). This is done by either assigning a label (from the set of labels in current scope) to a break/continue statement that doesn't have one (or has a label that's not present in the current scope). Additionally, it removes nested labelled statements with duplicate labels (also a requirement imposed by the spec).
rChooseElem :: [a] -> Int -> Gen [a] Source #
choose n elements from a list randomly
selectRandomElement :: [a] -> Gen a Source #
Selects a random element of the list
isSwitchStmt :: Statement a -> Bool Source #