Vik.Compiler (Vik v0.0.1-rc1)

View Source

Compiles the Shards into actual Elixir modules living in the Erlang VM.

Summary

Functions

Compiles the given Vik.Shard.

Same as eval/1, but raises if something crashes during compilation.

Extracts the list of module names that the given Vik.Shard exports.

Extracts a list of slugs for the shards that the given Vik.Shard depends on.

Generates a module name from a unique slug.

Types

quoted()

@type quoted() :: Macro.t()

slug()

@type slug() :: Vik.slug()

source()

@type source() :: String.t()

Functions

eval(shard)

@spec eval(Vik.Shard.t()) ::
  {:ok, term(), [Vik.export()], [slug()]} | {:error, term()}

Compiles the given Vik.Shard.

Returns the resulting module and any exports.

eval!(shard)

@spec eval!(Vik.Shard.t()) :: {term(), [module()], [slug()]}

Same as eval/1, but raises if something crashes during compilation.

extract_exports(shard)

@spec extract_exports(Vik.Shard.t()) :: [module()]

Extracts the list of module names that the given Vik.Shard exports.

extract_includes(shard)

@spec extract_includes(Vik.Shard.t()) :: [slug()]
@spec extract_includes(source()) :: [slug()]

Extracts a list of slugs for the shards that the given Vik.Shard depends on.

module_name(slug)

@spec module_name(slug()) :: module()

Generates a module name from a unique slug.