Class: Kumi::Core::Analyzer::Passes::IRValidatePass
- Defined in:
- lib/kumi/core/analyzer/passes/ir_validate_pass.rb
Direct Known Subclasses
Constant Summary
Constants inherited from PassBase
Class Attribute Summary collapse
-
.module_key ⇒ Object
readonly
Returns the value of attribute module_key.
-
.registry_aware ⇒ Object
readonly
Returns the value of attribute registry_aware.
-
.unoptimized_key ⇒ Object
readonly
Returns the value of attribute unoptimized_key.
-
.validator ⇒ Object
readonly
Returns the value of attribute validator.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from PassBase
contract_declared?, #debug, #debug_enabled?, declared_optional_reads, declared_reads, declared_writes, #initialize, optional_reads, reads, writes
Methods included from ErrorReporting
#inferred_location, #raise_localized_error, #raise_syntax_error, #raise_type_error, #report_enhanced_error, #report_error, #report_semantic_error, #report_syntax_error, #report_type_error
Constructor Details
This class inherits a constructor from Kumi::Core::Analyzer::Passes::PassBase
Class Attribute Details
.module_key ⇒ Object (readonly)
Returns the value of attribute module_key.
9 10 11 |
# File 'lib/kumi/core/analyzer/passes/ir_validate_pass.rb', line 9 def module_key @module_key end |
.registry_aware ⇒ Object (readonly)
Returns the value of attribute registry_aware.
9 10 11 |
# File 'lib/kumi/core/analyzer/passes/ir_validate_pass.rb', line 9 def registry_aware @registry_aware end |
.unoptimized_key ⇒ Object (readonly)
Returns the value of attribute unoptimized_key.
9 10 11 |
# File 'lib/kumi/core/analyzer/passes/ir_validate_pass.rb', line 9 def unoptimized_key @unoptimized_key end |
.validator ⇒ Object (readonly)
Returns the value of attribute validator.
9 10 11 |
# File 'lib/kumi/core/analyzer/passes/ir_validate_pass.rb', line 9 def validator @validator end |
Class Method Details
.validates(module_key, with:, unoptimized_key: nil, registry: false) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/kumi/core/analyzer/passes/ir_validate_pass.rb', line 11 def validates(module_key, with:, unoptimized_key: nil, registry: false) @module_key = module_key @validator = with @unoptimized_key = unoptimized_key @registry_aware = registry optional_reads module_key optional_reads unoptimized_key if unoptimized_key optional_reads :registry if registry writes end |
Instance Method Details
#run(_errors) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/kumi/core/analyzer/passes/ir_validate_pass.rb', line 23 def run(_errors) config = self.class if config.unoptimized_key && (unoptimized = state[config.unoptimized_key]) config.validator.validate!(unoptimized, allow_fold: true, registry: state[:registry]) end if (ir_module = state[config.module_key]) if config.registry_aware config.validator.validate!(ir_module, registry: state[:registry]) else config.validator.validate!(ir_module) end end state end |