forked from GitHub/gf-core
Make smaller SISR code for tokens.
This commit is contained in:
@@ -60,8 +60,12 @@ catSISR t (c,i) fmt
|
|||||||
| otherwise = []
|
| otherwise = []
|
||||||
|
|
||||||
profileFinalSISR :: CFTerm -> SISRFormat -> SISRTag
|
profileFinalSISR :: CFTerm -> SISRFormat -> SISRTag
|
||||||
profileFinalSISR term fmt = [fmtOut fmt `ass` f term]
|
profileFinalSISR term fmt = g term
|
||||||
where f (CFObj n ts) =
|
where
|
||||||
|
-- optimization for tokens
|
||||||
|
g (CFObj n []) = [field (fmtOut fmt) "name" `ass` JS.EStr (prIdent n)]
|
||||||
|
g t = [fmtOut fmt `ass` f t]
|
||||||
|
f (CFObj n ts) =
|
||||||
JS.ESeq $ [ret `ass` JS.ENew (JS.Ident "Object") [],
|
JS.ESeq $ [ret `ass` JS.ENew (JS.Ident "Object") [],
|
||||||
field ret "name" `ass` JS.EStr (prIdent n)]
|
field ret "name" `ass` JS.EStr (prIdent n)]
|
||||||
++ [field ret ("arg"++show i) `ass` f t
|
++ [field ret ("arg"++show i) `ass` f t
|
||||||
|
|||||||
Reference in New Issue
Block a user