Muex.Compiler
(Muex v0.6.1)
View Source
Compiles mutated ASTs and manages module hot-swapping.
Uses the language adapter for converting AST to source and compiling modules.
Summary
Functions
Compiles a mutated AST and loads it into the BEAM.
Compiles a mutated AST and writes it to a temporary file.
Generates the mutated source code string without writing to disk.
Restores the original module from its binary.
Functions
Compiles a mutated AST and loads it into the BEAM.
Parameters
mutation- The mutation map containing the mutated ASToriginal_ast- The original (complete) AST with mutation appliedmodule_name- The module name to compilelanguage_adapter- The language adapter module
Returns
{:ok, {module, original_binary}}- Successfully compiled and loaded module with original binary{:error, reason}- Compilation failed
Compiles a mutated AST and writes it to a temporary file.
This is used for port-based test execution where the mutated source needs to be on disk for a separate BEAM VM to compile.
Parameters
mutation- The mutation map containing the mutated ASTfile_entry- The file entry containing the original AST and pathlanguage_adapter- The language adapter module
Returns
{:ok, temp_file_path}- Successfully wrote mutated source to temp file{:error, reason}- Failed to write mutated source
Generates the mutated source code string without writing to disk.
This is preferred over compile_to_file/3 when the caller only needs the
source string (e.g. to write into a sandbox).
Returns
{:ok, source_string}- The mutated source code{:error, reason}- AST-to-source conversion failed
Restores the original module from its binary.
Parameters
module_name- The module to restoreoriginal_binary- The original module binary
Returns
:ok- Successfully restored{:error, reason}- Restoration failed