src/parser/method_finder.rb
# Given the index of the line preceding the method declaration. 
# Identifies the ending index of the method.
# If no end is found (most likely malformed code) then the nil is returned
Given the index of the line preceding the method declaration.
Identifies the ending index of the method.
If no end is found (most likely malformed code) then the nil is returned
Given the index of the line preceding the method declaration . Identifies the ending index of the method . If no end is found ( most likely malformed code ) then the nil is returned
def methodEndFinder(index)
        depthCounter = 1
        start = index
        test = 1
        prev_depth = 0
        begin
            index = start
            while index < @lines.length
                prev_depth = depthCounter
                result = check_line(index, depthCounter, test)
                index = result['index']
                depthCounter = result['depthCounter']
                if index == @new_name_end 
                    puts "renamed = #{@lines[index]}"
                    puts "#{depthCounter} > #{prev_depth} = #{depthCounter > prev_depth}"
                    if depthCounter > prev_depth
                        depthCounter -=1
                    end
                end
                if result['stop']
                    return index
                end
            end
            test += 1
        end while test <= 1
        return nil
    end
def methodEndFinder ( index ) depthCounter = 1 start = index test = 1 prev_depth = 0 begin index = start while index < @lines . length prev_depth = depthCounter result = check_line ( index , depthCounter , test ) index = result [ 'index' ] depthCounter = result [ 'depthCounter' ] if index == @new_name_end puts "renamed = #{@lines[index]}" puts "#{depthCounter} > #{prev_depth} = #{depthCounter > prev_depth}" if depthCounter > prev_depth depthCounter -= 1 end end if result [ 'stop' ] return index end end test += 1 end while test <= 1 return nil end
Given the index of the line preceding the method declaration.
Given the index of the line preceding the method declaration .
# Assume that a method has been found. Therefore assume count('}') == count('{') + 1 # Decrease the depthcounter to account for method renaming. # No end found
index
<not_specific>