Class: JrubyFileProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/providers/jruby_file_provider.rb

Instance Method Summary collapse

Constructor Details

#initializeJrubyFileProvider

Returns a new instance of JrubyFileProvider.



2
3
4
5
# File 'lib/providers/jruby_file_provider.rb', line 2

def initialize
  @current_function = ""
  @potential_dep = ""
end

Instance Method Details

#parse(node, data) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/providers/jruby_file_provider.rb', line 7

def parse(node, data)
  data.readlines do |line|
    if (line =~ /^public static.*[class|module].*RUBY\$(.*)\(.*$/)
      node.add_public_function $1
      @current_function = ""
    end

    if (line =~ /^public static.*method.*RUBY\$(.*)\(.*$/)
      @current_function = $1
      node.add_public_function @current_function
    elsif @current_function != "" and node.nodes[@current_function]
      function = node.nodes[@current_function]

      if (@potential_dep != "") and (line =~ /CallSite\.call/)
        node.add_dependency @current_function, @potential_dep
        @potential_dep = ""
      end

      if (line =~ /ldc.*\/\/String (.*)$/)
        @potential_dep = $1
      end

      if (line =~ /^(goto|goto_w|ifeq|ifne|if_|iflt|ifge||ifgt|ifle|
               ifnull|ifnonull|jsr|jsr_w).*$/)
        function.increase_edges
      end

      function.increase_size
    end
  end
end