Class: RuboCop::AST::NodePattern::Compiler::Debug

Inherits:
RuboCop::AST::NodePattern::Compiler show all
Defined in:
lib/rubocop/ast/node_pattern/compiler/debug.rb

Overview

Variant of the Compiler with tracing information for nodes

Defined Under Namespace

Modules: InstrumentationSubcompiler Classes: Colorizer, NodePatternSubcompiler, SequenceSubcompiler, Trace

Instance Attribute Summary collapse

Attributes inherited from RuboCop::AST::NodePattern::Compiler

#binding, #captures, #positional_parameters

Instance Method Summary collapse

Methods inherited from RuboCop::AST::NodePattern::Compiler

#compile_as_atom, #compile_as_node_pattern, #compile_sequence, #each_union, #freeze, #named_parameter, #next_capture, #positional_parameter, #with_temp_variables

Constructor Details

#initializeDebug

Returns a new instance of Debug.


123
124
125
126
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 123

def initialize
  super
  @node_ids = Hash.new { |h, k| h[k] = h.size }.compare_by_identity
end

Instance Attribute Details

#node_idsObject (readonly)

Returns the value of attribute node_ids.


33
34
35
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 33

def node_ids
  @node_ids
end

Instance Method Details

#named_parametersObject


128
129
130
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 128

def named_parameters
  super << :trace
end

#parserObject


132
133
134
# File 'lib/rubocop/ast/node_pattern/compiler/debug.rb', line 132

def parser
  @parser ||= Parser::WithMeta.new
end