git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: avoid some unnecessary thunking of eff funcs
ffca2d9Andy Arvanitis
src/Language/PureScript/CodeGen/Cpp/File.hs+4
@@ -48,6 +48,8 @@ toHeader = catMaybes . map go
48 Nothing
48 Nothing
49 go (CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
49 go (CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
50 Nothing
50 Nothing
51+ go (CppVariableIntroduction (name, _) _ (Just (CppLambda _ [] rty _))) =
52+ Just $ CppFunction name [] rty [] CppNoOp
51 -- Generate thunks for top-level values
53 -- Generate thunks for top-level values
52 go (CppVariableIntroduction (name, _) _ (Just _)) =
54 go (CppVariableIntroduction (name, _) _ (Just _)) =
53 Just $ CppVariableIntroduction (name, Just $ CppAny [CppConst]) [CppExtern] Nothing
55 Just $ CppVariableIntroduction (name, Just $ CppAny [CppConst]) [CppExtern] Nothing
@@ -109,6 +111,8 @@ toBody = catMaybes . map go
109 Nothing
111 Nothing
110 go (CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
112 go (CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
111 Nothing
113 Nothing
114+ go (CppVariableIntroduction (name, _) _ (Just (CppLambda _ [] rty body))) =
115+ Just $ CppFunction name [] rty [] body
112 -- Generate thunks for top-level values
116 -- Generate thunks for top-level values
113 go (CppVariableIntroduction (name, _) _ (Just cpp)) =
117 go (CppVariableIntroduction (name, _) _ (Just cpp)) =
114 Just $ CppVariableIntroduction (name, Just $ CppAny [CppConst]) [] (Just lambda)
118 Just $ CppVariableIntroduction (name, Just $ CppAny [CppConst]) [] (Just lambda)