@@ -50,16 +50,18 @@ toHeader = catMaybes . map go
51 go (CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
51 go (CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
53+ go (CppVariableIntroduction _ _ (Just (CppUnary _ (CppNumericLiteral {})))) =
53 go (CppVariableIntroduction (name, _) _ (Just (CppLambda _ [] rty _))) =
55 go (CppVariableIntroduction (name, _) _ (Just (CppLambda _ [] rty _))) =
54 Just $ CppFunction name [] rty [] CppNoOp
56 Just $ CppFunction name [] rty [] CppNoOp
56 -- Generate thunks for top-level values
58 -- Generate thunks for top-level values
57− go (CppVariableIntroduction (name, vty) _ (Just cpp)) =
59+ go (CppVariableIntroduction (name, _) _ (Just cpp)) =
58 case cpp of
60 case cpp of
59 CppObjectLiteral CppInstance vals ->
61 CppObjectLiteral CppInstance vals ->
60 Just $ CppFunction name [("", Just thunkMarkerType)] (Just $ CppAny [CppConst, CppRef]) [] CppNoOp
62 Just $ CppFunction name [("", Just thunkMarkerType)] (Just $ CppAny [CppConst, CppRef]) [] CppNoOp
62− Just $ CppVariableIntroduction (name, vty) [CppExtern] Nothing
64+ Just $ CppVariableIntroduction (name, Just $ CppAny [CppConst]) [CppExtern] Nothing
63 go cpp@(CppStruct {}) =
65 go cpp@(CppStruct {}) =
65 go (CppComment comms cpp')
67 go (CppComment comms cpp')
@@ -87,6 +89,8 @@ toHeaderFns = catMaybes . map go
88 go cpp@(CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
90 go cpp@(CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
92+ go cpp@(CppVariableIntroduction _ _ (Just (CppUnary _ (CppNumericLiteral {})))) =
90 go (CppComment comms cpp') | Just cpp <- go cpp' = Just (CppComment comms cpp)
94 go (CppComment comms cpp') | Just cpp <- go cpp' = Just (CppComment comms cpp)
91 go _ = Nothing
95 go _ = Nothing
@@ -118,14 +122,18 @@ toBody = catMaybes . map go
119 go (CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
123 go (CppVariableIntroduction _ _ (Just CppBooleanLiteral {})) =
125+ go (CppVariableIntroduction _ _ (Just (CppUnary _ (CppNumericLiteral {})))) =
121 go (CppVariableIntroduction (name, _) _ (Just (CppLambda _ [] rty body))) =
127 go (CppVariableIntroduction (name, _) _ (Just (CppLambda _ [] rty body))) =
122 Just $ CppFunction name [] rty [] body
128 Just $ CppFunction name [] rty [] body
130+ -- Generate thunks for top-level values
123− go (CppVariableIntroduction (name, vty) _ (Just cpp)) =
131+ go (CppVariableIntroduction (name, _) _ (Just cpp)) =
124 case cpp of
132 case cpp of
125 CppObjectLiteral CppInstance vals ->
133 CppObjectLiteral CppInstance vals ->
126 Just $ CppFunction name [("", Just thunkMarkerType)] (Just $ CppAny [CppConst, CppRef]) [] block
134 Just $ CppFunction name [("", Just thunkMarkerType)] (Just $ CppAny [CppConst, CppRef]) [] block
128− Just $ CppVariableIntroduction (name, vty) [] (Just lambda)
136+ Just $ CppVariableIntroduction (name, Just $ CppAny [CppConst]) [] (Just lambda)
130 val = CppVariableIntroduction ("$value$", Just $ CppAny [CppConst]) [CppStatic] (Just $ addCaptures cpp)
138 val = CppVariableIntroduction ("$value$", Just $ CppAny [CppConst]) [CppStatic] (Just $ addCaptures cpp)
131 block = CppBlock [val, CppReturn (CppVar "$value$")]
139 block = CppBlock [val, CppReturn (CppVar "$value$")]