Fix function definition
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
export
|
export
|
||||||
function :t $f
|
function :t $f (env %env, w %a, d %b, ...) {
|
||||||
(env %env, w %a, d %b, ...)
|
@l
|
||||||
{@l
|
ret
|
||||||
ret }
|
}
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
data $str =
|
data $str =
|
||||||
{b "hello world", b 0}
|
{b "hello world", b 0}
|
||||||
export
|
export
|
||||||
function w $main
|
function w $main () {
|
||||||
()
|
@start
|
||||||
{@start
|
%r =w call $puts (l $str)
|
||||||
%r =w call $puts (l $str)
|
ret 0
|
||||||
ret 0}
|
}
|
||||||
@@ -15,7 +15,7 @@ import Data.List.NonEmpty (NonEmpty, toList)
|
|||||||
import Data.Maybe (maybeToList)
|
import Data.Maybe (maybeToList)
|
||||||
import Prettyprinter
|
import Prettyprinter
|
||||||
( Pretty(pretty), Doc, (<+>), vsep, hsep, hang, punctuate, group, flatAlt
|
( Pretty(pretty), Doc, (<+>), vsep, hsep, hang, punctuate, group, flatAlt
|
||||||
, space, encloseSep, tupled, comma, equals, braces )
|
, space, encloseSep, tupled, comma, equals, braces, lbrace, rbrace )
|
||||||
-- Instances
|
-- Instances
|
||||||
import Data.Hashable (Hashable)
|
import Data.Hashable (Hashable)
|
||||||
import Control.DeepSeq (NFData)
|
import Control.DeepSeq (NFData)
|
||||||
@@ -194,12 +194,13 @@ data FuncDef = FuncDef [Linkage] (Maybe AbiTy) (Ident 'Global) (Maybe (Ident 'Te
|
|||||||
instance Pretty FuncDef where
|
instance Pretty FuncDef where
|
||||||
pretty (FuncDef linkage abiTy ident env params variadic blocks) = vsep
|
pretty (FuncDef linkage abiTy ident env params variadic blocks) = vsep
|
||||||
[ vsep $ pretty <$> linkage
|
[ vsep $ pretty <$> linkage
|
||||||
, "function" <+> pretty abiTy <+> pretty ident
|
, "function" <+> pretty abiTy <+> pretty ident <+> tupled (
|
||||||
, tupled $
|
|
||||||
maybeToList (("env" <+>) . pretty <$> env)
|
maybeToList (("env" <+>) . pretty <$> env)
|
||||||
++ fmap pretty params
|
++ fmap pretty params
|
||||||
++ maybeToList (prettyVariadic variadic)
|
++ maybeToList (prettyVariadic variadic)
|
||||||
, braces $ vsep $ toList $ pretty <$> blocks
|
) <+> lbrace
|
||||||
|
, vsep $ toList $ pretty <$> blocks
|
||||||
|
, rbrace
|
||||||
]
|
]
|
||||||
|
|
||||||
data AbiTy = AbiBaseTy BaseTy | AbiAggregateTy (Ident 'AggregateTy)
|
data AbiTy = AbiBaseTy BaseTy | AbiAggregateTy (Ident 'AggregateTy)
|
||||||
|
|||||||
Reference in New Issue
Block a user