Skip to content

Commit

Permalink
--wip--
Browse files Browse the repository at this point in the history
  • Loading branch information
TotalVerb committed May 5, 2017
1 parent d5578f3 commit cb528c5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/SemanticASTs/functiondef.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,16 @@ function show(io::IO, ast::MethodDefinition)
end
print("code=", code(ast), ")")
end

function annotateⁿ(::Type{FunctionDefinition}, ast::AST)
if isexpr(ast, :function) && length(ast.args) == 2
fn = ast.args[1]
body = ast.args[2]
if isexpr(fn, :tuple)
Lambda(signature=fn, code=SemanticAST(body))
elseif isexpr(fn, :call)
fnname = annotateⁿ(FunctionName, fn)
MethodDefinition(func=fnname, signature=fn, code=SemanticAST(body))
end
end
end

0 comments on commit cb528c5

Please sign in to comment.