@@ -70,7 +70,7 @@ nativeFunctionDef = parens func
70
70
args <- squares $ many identifierWithType
71
71
let len = length args
72
72
-- check if only the last element is variadic
73
- fnTransformer (fst id ) args
73
+ fnTransformer True (fst id ) args
74
74
75
75
-- (defun some-fn [(arg1: int, arg2: int, ...)] { ... })
76
76
-- can also have variadic arguments, for example arg3 in
@@ -91,10 +91,10 @@ functionDef = parens func
91
91
id <- optionallyTypedIdentifier
92
92
args <- squares $ many identifierWithType
93
93
-- check if only the last element is variadic
94
- fnTransformer id args
94
+ fnTransformer False id args
95
95
96
- fnTransformer :: (T. Text , VDataType ) -> [((T. Text , VDataType ), Bool )] -> Parser Expr
97
- fnTransformer id args = do
96
+ fnTransformer :: Bool -> (T. Text , VDataType ) -> [((T. Text , VDataType ), Bool )] -> Parser Expr
97
+ fnTransformer isNative id args = do
98
98
let len = length args
99
99
args' <- rFoldl
100
100
(zip [(1 :: Int ) .. ] args)
@@ -111,7 +111,7 @@ fnTransformer id args = do
111
111
else fail " Only the last argument of a function can be variadic!"
112
112
else -- if not variadic, just add to accumulator
113
113
pure (val, False )
114
- body <- braces exprs
114
+ body <- if isNative then pure [] else braces exprs
115
115
pure $ uncurry FunctionDef id args' body False
116
116
117
117
arbitraryBlock :: Parser Expr
0 commit comments