Skip to content

Commit

Permalink
Fix @SPEC
Browse files Browse the repository at this point in the history
  • Loading branch information
Neylix committed Jul 25, 2023
1 parent 1b469f6 commit e55634c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/archethic/contracts/interpreter/action_interpreter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ defmodule Archethic.Contracts.Interpreter.ActionInterpreter do
alias Archethic.TransactionChain.TransactionData

alias Archethic.Contracts.ContractConstants, as: Constants
alias Archethic.Contracts.Interpreter
alias Archethic.Contracts.Interpreter.ASTHelper, as: AST
alias Archethic.Contracts.Interpreter.CommonInterpreter
alias Archethic.Contracts.Interpreter.Library
Expand Down
7 changes: 5 additions & 2 deletions lib/archethic/contracts/interpreter/function_interpreter.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defmodule Archethic.Contracts.Interpreter.FunctionInterpreter do
@moduledoc false
alias Archethic.Contracts.Interpreter
alias Archethic.Contracts.Interpreter.ASTHelper, as: AST
alias Archethic.Contracts.Interpreter.Scope
alias Archethic.Contracts.Interpreter.CommonInterpreter
Expand All @@ -8,8 +9,9 @@ defmodule Archethic.Contracts.Interpreter.FunctionInterpreter do
@doc """
Parse the given node and return the function name it's args as strings and the AST block.
"""
@spec parse(any(), list(Interpreter.function_key())) ::
{:ok, atom(), any()} | {:error, any(), String.t()}
@spec parse(ast :: any(), function_keys :: list(Interpreter.function_key())) ::
{:ok, function_name :: binary(), args :: list(), function_ast :: any()}
| {:error, node :: any(), reason :: binary()}
def parse({{:atom, "fun"}, _, [{{:atom, function_name}, _, args}, [do: block]]}, functions_keys) do
ast = parse_block(AST.wrap_in_block(block), functions_keys)
args = parse_args(args)
Expand Down Expand Up @@ -46,6 +48,7 @@ defmodule Archethic.Contracts.Interpreter.FunctionInterpreter do
@doc """
Execute function code and returns the result
"""
@spec execute(ast :: any(), constants :: map()) :: result :: any()
def execute(ast, constants) do
Scope.init(constants)
{result, _} = Code.eval_quoted(ast)
Expand Down

0 comments on commit e55634c

Please sign in to comment.