lib/simplabs/excellent/parsing/code_processor.rb in simplabs-excellent-1.3.1 vs lib/simplabs/excellent/parsing/code_processor.rb in simplabs-excellent-1.4.0
- old
+ new
@@ -9,10 +9,11 @@
require 'simplabs/excellent/parsing/module_context'
require 'simplabs/excellent/parsing/for_loop_context'
require 'simplabs/excellent/parsing/while_context'
require 'simplabs/excellent/parsing/until_context'
require 'simplabs/excellent/parsing/cvar_context'
+require 'simplabs/excellent/parsing/ivar_context'
require 'simplabs/excellent/parsing/resbody_context'
require 'simplabs/excellent/parsing/call_context'
module Simplabs
@@ -51,10 +52,14 @@
def process_defs(exp)
process_default(exp, SingletonMethodContext.new(exp, @contexts.last))
end
+ def process_ivar(exp)
+ process_default(exp, IvarContext.new(exp, @contexts.last))
+ end
+
def process_cvar(exp)
process_default(exp, CvarContext.new(exp, @contexts.last))
end
def process_if(exp)
@@ -116,11 +121,11 @@
private
def apply_checks(exp)
if exp.is_a?(Sexp)
- checks = @checks[exp.node_type]
- checks.each { |check| check.evaluate_node(@contexts.last) } unless checks.nil?
+ checks = @checks[exp.node_type] || []
+ checks.each { |check| check.evaluate_node(@contexts.last) if check.interesting_files.any? { |pattern| File.basename(exp.file) =~ pattern } }
end
end
def setup_checks(checks)
@checks = {}