Class: Evilution::Integration::Loading::MutationApplier Private
- Inherits:
-
Object
- Object
- Evilution::Integration::Loading::MutationApplier
- Defined in:
- lib/evilution/integration/loading/mutation_applier.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Composes the load-time pipeline that applies a mutation's new source to the
running VM: syntax-validate -> pin top-level constants (beats Zeitwerk) ->
clear AS::Concern state -> eval inside a redefinition-recovery wrapper.
The eval target is mutation.eval_source, which Mutator::Base pre-populates
with the neutralized form (non-idempotent class-body calls replaced with
nil). The neutralization itself happens once at mutation-generation time
rather than per-iter — SyntaxValidator still runs Prism per mutation, but
the extra neutralizer parse stays out of the hot path. Falls back to
mutation.mutated_source when no pre-eval transform was attached.
RedefinitionRecovery stays as a safety net for cases the neutralizer's
allowlist heuristic misses. Returns nil on success or a failure-shaped
hash on any error.
Instance Method Summary collapse
- #call(mutation) ⇒ Object private
-
#initialize(syntax_validator: Evilution::Integration::Loading::SyntaxValidator.new, constant_pinner: Evilution::Integration::Loading::ConstantPinner.new, concern_state_cleaner: Evilution::Integration::Loading::ConcernStateCleaner.new, source_evaluator: Evilution::Integration::Loading::SourceEvaluator.new, redefinition_recovery: Evilution::Integration::Loading::RedefinitionRecovery.new) ⇒ MutationApplier
constructor
private
A new instance of MutationApplier.
Constructor Details
#initialize(syntax_validator: Evilution::Integration::Loading::SyntaxValidator.new, constant_pinner: Evilution::Integration::Loading::ConstantPinner.new, concern_state_cleaner: Evilution::Integration::Loading::ConcernStateCleaner.new, source_evaluator: Evilution::Integration::Loading::SourceEvaluator.new, redefinition_recovery: Evilution::Integration::Loading::RedefinitionRecovery.new) ⇒ MutationApplier
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MutationApplier.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/evilution/integration/loading/mutation_applier.rb', line 23 def initialize(syntax_validator: Evilution::Integration::Loading::SyntaxValidator.new, constant_pinner: Evilution::Integration::Loading::ConstantPinner.new, concern_state_cleaner: Evilution::Integration::Loading::ConcernStateCleaner.new, source_evaluator: Evilution::Integration::Loading::SourceEvaluator.new, redefinition_recovery: Evilution::Integration::Loading::RedefinitionRecovery.new) @syntax_validator = syntax_validator @constant_pinner = constant_pinner @concern_state_cleaner = concern_state_cleaner @source_evaluator = source_evaluator @redefinition_recovery = redefinition_recovery end |
Instance Method Details
#call(mutation) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/evilution/integration/loading/mutation_applier.rb', line 35 def call(mutation) eval_target = resolve_eval_target(mutation) syntax_error = @syntax_validator.call(eval_target) return syntax_error if syntax_error apply(mutation, eval_target) nil rescue SyntaxError => e failure_result(e, "syntax error in mutated source: #{e.}") rescue ScriptError, StandardError => e failure_result(e, "#{e.class}: #{e.}") end |