File tree 3 files changed +7
-2
lines changed
3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ instance ConvertToJs Salty where
166
166
toJs (Operation left Spaceship right) = print2 " % <=> %" (toJs left) (toJs right)
167
167
168
168
toJs (Function name args body visibility scope)
169
- | scope == ClassScope = print3 " \n %(%) {\n %\n }\n " funcName funcArgs (funcBody body)
169
+ | scope == ClassScope = print3 " %(%) {\n %\n }\n " funcName funcArgs (funcBody body)
170
170
| otherwise = print3 " const % = (%) => {\n %\n }\n " funcName funcArgs (funcBody body)
171
171
where funcName = funcVisibility ++ (simpleVarName name)
172
172
-- the parser strips out the leading '_' but we need to put it back for JS
@@ -347,6 +347,8 @@ instance ConvertToJs Salty where
347
347
toJs (Keyword (KwPreceding " const" (Operation (Constant (Variable var _)) op right))) = " const " ++ (toJs (Operation (PurePhp (simpleVarName var)) op right))
348
348
toJs (Keyword (KwPreceding " const" (Constant (Variable var _)))) = " const " ++ (simpleVarName var)
349
349
toJs (Keyword (KwPreceding " const" (Variable var _))) = " const " ++ (simpleVarName var)
350
+
351
+ toJs (Keyword (KwPreceding " export" (Keyword (KwPreceding " default" f@ (Function n a b v s))))) = " export default function " ++ (toJs (Function n a b v ClassScope ))
350
352
toJs (Keyword (KwPreceding str salty)) = str ++ " " ++ (toJs salty)
351
353
toJs (Keyword (KwSimple str)) = str
352
354
toJs (Range (SaltyNumber l) (SaltyNumber r)) = show $ [left.. right]
Original file line number Diff line number Diff line change @@ -707,5 +707,6 @@ jsTests = [
707
707
" h1 (myVar.foo)" `matches` " <h1>{myVar.foo}</h1>" ,
708
708
" h1 (@myVar.bar)" `matches` " <h1>{this.myVar.bar}</h1>" ,
709
709
" h1 (@@myVar.baz)" `matches` " <h1>{this.state.myVar.baz}</h1>" ,
710
- " h1 ('hello, ' ++ name ++ '!')" `matches` " <h1>{\" hello, \" + name + \" !\" }</h1>"
710
+ " h1 ('hello, ' ++ name ++ '!')" `matches` " <h1>{\" hello, \" + name + \" !\" }</h1>" ,
711
+ " export default foo := 1" `matches` " export default function foo() {\n return 1;\n }"
711
712
]
Original file line number Diff line number Diff line change @@ -38,3 +38,5 @@ in a where clause, all those vars need to be defined w a const or a let.
38
38
39
39
would be cool to add some basic checks as warnings. Like constructors of react components need to have a super(props) call.
40
40
getChildContext needs to be matched with a childContextTypes. Functions that use a context need to define contextTypes. etc.
41
+
42
+ listings.prices.0 should resolve to listing.prices[0]
You can’t perform that action at this time.
0 commit comments