module T::Props::GeneratedCodeValidation

def self.validate_lack_of_side_effects(node, whitelisted_methods_by_receiver_type)

def self.validate_lack_of_side_effects(node, whitelisted_methods_by_receiver_type)
ause we'll have validated what method has been called
 :str, :sym, :int, :float, :true, :false, :nil, :self
lf are ok
ivar
 instance variables & arguments is ok
ren.all? {|c| c.is_a?(Symbol)}
nError.new("Unexpected child for #{node.type}: #{node.inspect}")
:block, :begin, :if
read-only if their contents are read-only
h {|c| validate_lack_of_side_effects(c, whitelisted_methods_by_receiver_type) if c}
er so check a whitelist
 *args = node.children
e == :send
r
r.type
_of_side_effects(receiver, whitelisted_methods_by_receiver_type)
_methods_by_receiver_type[key]&.include?(method)
ionError.new("Unexpected method #{method} called on #{receiver.inspect}")
|
f_side_effects(arg, whitelisted_methods_by_receiver_type)
rror.new("Unexpected node type #{node.type}: #{node.inspect}")