git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
fixes #2581: generate JS static member accesses whenever possible
commit5b3b7596ea9c5ed24aab534f1331d4e57d44f492 authorMichael Ficarra <mficarra@shapesecurity.com> dateWed 18 Jan 2017, 19:29 (10 years ago) parentd2c4b07
1 file changed+4−4
src/Language/PureScript/Pretty/JS.hs+4−4
src/Language/PureScript/Pretty/JS.hs+4−4
@@ -159,12 +159,12 @@ conditional = mkPattern match
159159 match (JSConditional ss cond th el) = Just ((ss, th, el), cond)
160160 match _ = Nothing
161161
162−accessor :: (Emit gen) => Pattern PrinterState JS (gen, JS)
162+accessor :: Pattern PrinterState JS (Text, JS)
163163accessor = mkPattern match
164164 where
165165 match (JSIndexer _ (JSStringLiteral _ prop) val) =
166166 case decodeString prop of
167− Just s | not (identNeedsEscaping s) -> Just (emit s, val)
167+ Just s | not (identNeedsEscaping s) -> Just (s, val)
168168 _ -> Nothing
169169 match _ = Nothing
170170
@@ -259,8 +259,8 @@ prettyPrintJS' = A.runKleisli $ runPattern matchValue
259259 matchValue = buildPrettyPrinter operators (literals <+> fmap parensPos matchValue)
260260 operators :: (Emit gen) => OperatorTable PrinterState JS gen
261261 operators =
262− OperatorTable [ [ Wrap accessor $ \prop val -> val <> emit "." <> prop ]
263− , [ Wrap indexer $ \index val -> val <> emit "[" <> index <> emit "]" ]
262+ OperatorTable [ [ Wrap indexer $ \index val -> val <> emit "[" <> index <> emit "]" ]
263+ , [ Wrap accessor $ \prop val -> val <> emit "." <> emit prop ]
264264 , [ Wrap app $ \args val -> val <> emit "(" <> args <> emit ")" ]
265265 , [ unary JSNew "new " ]
266266 , [ Wrap lam $ \(name, args, ss) ret -> addMapping' ss <>