Class: Kumi::IR::DF::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/kumi/ir/df/validator.rb

Constant Summary collapse

CANONICAL_OPS =
%i[
  constant
  load_input
  load_field
  map
  select
  reduce
  decl_ref
  make_object
  array_build
  array_get
  array_len
  axis_index
  import_call
  axis_shift
  axis_broadcast
].freeze
PRE_CANONICAL_OPS =
(CANONICAL_OPS + %i[fold]).freeze
FN_REF_OPS =
%i[map reduce fold].freeze
DEFAULT_TARGETS =
%i[ruby javascript].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(df_module, allow_fold: false, registry: nil, targets: DEFAULT_TARGETS) ⇒ Validator

Returns a new instance of Validator.



35
36
37
38
39
40
# File 'lib/kumi/ir/df/validator.rb', line 35

def initialize(df_module, allow_fold: false, registry: nil, targets: DEFAULT_TARGETS)
  @df_module = df_module
  @allow_fold = allow_fold
  @registry = registry
  @targets = targets
end

Class Method Details

.validate!(df_module, allow_fold: false, registry: nil, targets: DEFAULT_TARGETS) ⇒ Object



30
31
32
33
# File 'lib/kumi/ir/df/validator.rb', line 30

def self.validate!(df_module, allow_fold: false, registry: nil, targets: DEFAULT_TARGETS)
  new(df_module, allow_fold:, registry:, targets:).validate!
  df_module
end

Instance Method Details

#validate!Object



42
43
44
# File 'lib/kumi/ir/df/validator.rb', line 42

def validate!
  df_module.each_function { |fn| validate_function(fn) }
end