def apply_definitions(node)
      # Apply definition check to all of the node's children
      process_definitions = proc do |children|
        children.each do |child|
          # Check if we have a definition
          is_definition = if child[@value] == @current_def
                            child[@options][:recursive]
                          else
                            @definitions.key?(child[@value])
                          end

          # Set child as a defined node
          child[@type] = :def if is_definition

          # Recursively apply definitions to child nodes
          apply_definitions child if child[@children]
        end
      end

      # Apply definitions to each case of the control node
      if [:if, :unless, :case].include? node[@type]
        node[@children].each do |array|
          process_definitions[array]
        end
      # Apply definition to all of the node's children
      else
        process_definitions[node[@children]]
      end
    end
def apply_definitions(node)
      # Apply definition check to all of the node's children
      process_definitions = proc do |children|
        children.each do |child|
          # Check if we have a definition
          is_definition = if child[@value] == @current_def
                            child[@options][:recursive]
                          else
                            @definitions.key?(child[@value])
                          end

          # Set child as a defined node
          child[@type] = :def if is_definition

          # Recursively apply definitions to child nodes
          apply_definitions child if child[@children]
        end
      end

      # Apply definitions to each case of the control node
      if [:if, :unless, :case].include? node[@type]
        node[@children].each do |array|
          process_definitions[array]
        end
      # Apply definition to all of the node's children
      else
        process_definitions[node[@children]]
      end
    end
Set each node as a defined node if a definition exists with the given
 node name, unless we're inside a definition with the same name as the node
 because we want to avoid recursion.

 @param node [Node] Input Node to checked for existence of definitions