1module Generate.JavaScript.Helpers where
3import Language.ECMAScript3.Syntax
5import qualified Reporting.Region as R
13varDecl :: String -> Expression () -> VarDecl ()
15 VarDecl () (var x) (Just expr)
18make :: [String] -> Expression ()
20 obj (moduleName ++ ["make"]) <| ref localRuntime
23useLazy :: [String] -> String -> Expression ()
24useLazy moduleName functionName =
25 DotRef () (make moduleName) (var functionName)
35ref :: String -> Expression ()
40prop :: String -> Prop ()
48obj :: [String] -> Expression ()
51 x:xs -> foldl (DotRef ()) (ref x) (map var xs)
52 [] -> error "dotSep must be called on a non-empty list of variables"
57localModuleName :: String
62throw :: String -> R.Region -> Expression ()
66 , string (R.toString region)
69 obj ["_U",kind] `call` args
74(<|) :: Expression () -> Expression () -> Expression ()
79ret :: Expression () -> Statement ()
81 ReturnStmt () (Just e)
84(==>) :: [String] -> Expression () -> Expression ()
86 FuncExpr () Nothing (map var args) [ ret e ]
89function :: [String] -> [Statement ()] -> Expression ()
91 FuncExpr () Nothing (map var args) stmts
94call :: Expression () -> [Expression ()] -> Expression ()
101equal :: Expression () -> Expression () -> Expression ()
103 InfixExpr () OpStrictEq a b
106instanceof :: String -> Expression () -> Expression ()
108 InfixExpr () OpLAnd (typeof "object" x) (InfixExpr () OpInstanceof x (ref tipe))
111typeof :: String -> Expression () -> Expression ()
113 equal (PrefixExpr () PrefixTypeof x) (string tipe)
116member :: String -> Expression () -> Expression ()
118 InfixExpr () OpIn (string field) x
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list