Skip to content

Commit

Permalink
Merge pull request #203 from EpitechPromo2027/201-returning-void-is-b…
Browse files Browse the repository at this point in the history
…roken

fix: Function returning void
  • Loading branch information
G0nzal0zz authored Jan 15, 2025
2 parents a93e3b1 + ecd33dc commit e1133d9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Codegen/Codegen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,9 @@ generateFunction (AT.Function _ name (AT.TFunction ret params var) paramNames bo
oldAllocatedVars <- S.gets allocatedVars
preAllocateVars body
result <- generateExpr body
I.ret result
case ret of
AT.TVoid -> I.retVoid
_ -> I.ret result
S.modify (\s -> s {allocatedVars = oldAllocatedVars})
where
mkParam t n = (toLLVM t, M.ParameterName $ U.stringToByteString n)
Expand Down

0 comments on commit e1133d9

Please # to comment.