lib/reek/tree_walker.rb in reek-3.5.0 vs lib/reek/tree_walker.rb in reek-3.6.0

- old
+ new

@@ -1,9 +1,10 @@ require_relative 'context/method_context' require_relative 'context/module_context' require_relative 'context/root_context' require_relative 'context/singleton_method_context' +require_relative 'context/attribute_context' require_relative 'ast/node' module Reek # # Traverses an abstract syntax tree and fires events whenever it encounters @@ -93,11 +94,11 @@ element.track_visibility(exp.method_name, exp.arg_names) end if exp.attribute_writer? exp.args.each do |arg| next unless arg.type == :sym - new_context(Context::MethodContext, arg) + new_context(Context::AttributeContext, arg, exp) end end element.record_call_to(exp) process_default(exp) end @@ -200,11 +201,11 @@ push(new_context(klass, exp)) do yield end end - def new_context(klass, exp) - klass.new(element, exp).tap do |scope| + def new_context(klass, *args) + klass.new(element, *args).tap do |scope| element.append_child_context(scope) end end def push(scope)