dsl-fixes/simple_fixes.rb
# Copied from AssignInstanceNode
# TODO Refactor to use same code!
Copied from AssignInstanceNode
TODO Refactor to use same code!
Copied from AssignInstanceNode TODO Refactor to use same code!
def fix_attribute
    class_node = find_surrounding ClassOrModuleNode
    def_node = find_surrounding DefNode
    if def_node.static_method?
      attribute = class_node.find_static_attribute name
      unless attribute
        attribute = class_node.add_static_attribute ruby_node, name
        d "#{attribute} #{class_node} #{value} static"
      end
    else
      attribute = class_node.find_attribute name
      unless attribute
        attribute = class_node.add_attribute ruby_node, name
        d "#{attribute} #{class_node} #{value}"
      end
    end
    attribute.cls = value.cls if value.respond_to? 'cls'
    @attribute = attribute
    return self
  end
def fix_attribute class_node = find_surrounding ClassOrModuleNode def_node = find_surrounding DefNode if def_node . static_method? attribute = class_node . find_static_attribute name unless attribute attribute = class_node . add_static_attribute ruby_node , name d "#{attribute} #{class_node} #{value} static" end else attribute = class_node . find_attribute name unless attribute attribute = class_node . add_attribute ruby_node , name d "#{attribute} #{class_node} #{value}" end end attribute . cls = value . cls if value . respond_to? 'cls' @attribute = attribute return self end
Copied from AssignInstanceNode
TODO Refactor to use same code!
Copied from AssignInstanceNode TODO Refactor to use same code!
# return self unless value.respond_to? :cls