Packages
bond
1.2.1
1.13.0
1.12.0
1.11.0
1.10.1
1.10.0
1.9.0
1.8.0
1.7.0
1.6.0
1.5.0
1.4.0
1.3.0
1.3.0-rc.1
1.2.1
1.2.0
1.1.0
1.0.0
1.0.0-rc.4
1.0.0-rc.3
1.0.0-rc.2
1.0.0-rc.1
0.18.0
0.17.5
0.17.4
0.17.3
0.17.2
0.17.1
0.17.0
0.16.2
0.16.1
0.16.0
0.15.0
0.14.0
0.13.0
0.12.0
0.11.0
0.10.0
0.9.1
0.9.0
0.8.3
0.8.2
0.8.1
0.1.0
Design by Contract (DbC) for Elixir
Current section
Files
Jump to
Current section
Files
lib/bond/compiler/annotated_function/clause.ex
defmodule Bond.Compiler.AnnotatedFunction.Clause do
@moduledoc internal: true
@moduledoc """
Struct to represent an individual clause of a function.
"""
alias Bond.Compiler.FunctionDefinition
defstruct [:env, :params, :guards, :body, :warn_skipped_invariants_override]
@type t :: %__MODULE__{
env: Macro.Env.t() | nil,
params: list() | nil,
guards: list() | nil,
body: keyword() | nil,
warn_skipped_invariants_override: nil | boolean()
}
def new(%FunctionDefinition{} = function_def) do
struct(
__MODULE__,
Map.take(function_def, [
:env,
:params,
:guards,
:body,
:warn_skipped_invariants_override
])
)
end
end