static_source_loc 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/static_source_loc.rb +6 -3
- metadata +1 -1
data/lib/static_source_loc.rb
CHANGED
@@ -3,7 +3,7 @@ require 'find'
|
|
3
3
|
require 'ruby_parser'
|
4
4
|
|
5
5
|
module StaticSourceLoc
|
6
|
-
VERSION = '
|
6
|
+
VERSION = '1.0.0'
|
7
7
|
|
8
8
|
SourceLoc = Struct.new :file, :line
|
9
9
|
|
@@ -131,7 +131,9 @@ module StaticSourceLoc
|
|
131
131
|
sexprs = load_sexprs(dir, file_test, dir_test, ignore_errors)
|
132
132
|
toplevel = ModuleSource.new :Object, nil
|
133
133
|
sexprs.each &toplevel.method(:process_code)
|
134
|
-
toplevel
|
134
|
+
submodules = toplevel.submodules
|
135
|
+
submodules.values.each {|ms| ms.instance_variable_set :@parent, nil}
|
136
|
+
submodules.merge toplevel.methods
|
135
137
|
end
|
136
138
|
|
137
139
|
private
|
@@ -148,7 +150,8 @@ module StaticSourceLoc
|
|
148
150
|
sexprs = files.map do |fn|
|
149
151
|
File.open fn do |file|
|
150
152
|
begin
|
151
|
-
Parser.
|
153
|
+
Parser.reset
|
154
|
+
Parser.parse file.read, fn
|
152
155
|
rescue RubyParser::SyntaxError, Racc::ParseError
|
153
156
|
raise unless ignore_errors
|
154
157
|
end
|