Sha256: ff977c2eccca07b8c5d65bb849e99e7c00ef1092ccfca5b7bccaf9922fa02c2b

Contents?: true

Size: 1.75 KB

Versions: 32

Compression:

Stored size: 1.75 KB

Contents

# frozen_string_literal: true

module Mutant
  module AST
    # Groups of node types
    module Types
      ASSIGNABLE_VARIABLES = Set.new(%i[ivasgn lvasgn cvasgn gvasgn]).freeze

      INDEX_ASSIGN_OPERATOR = :[]=

      # Set of nodes that cannot be on the LHS of an assignment
      NOT_ASSIGNABLE         = Set.new(%i[int float str dstr class module self nil]).freeze

      # Set of op-assign types
      OP_ASSIGN              = Set.new(%i[or_asgn and_asgn op_asgn]).freeze
      # Set of node types that are not valid when emitted standalone
      NOT_STANDALONE         = Set.new(%i[splat restarg block_pass]).freeze
      INDEX_OPERATORS        = Set.new(%i[[] []=]).freeze
      UNARY_METHOD_OPERATORS = Set.new(%i[~@ +@ -@ !]).freeze

      # Operators ruby implements as methods
      METHOD_OPERATORS = Set.new(%i[
        !
        !=
        !~
        %
        &
        *
        **
        +
        +@
        -
        -@
        /
        <
        <<
        <=
        <=>
        ==
        ===
        =~
        >
        >=
        >>
        []
        []=
        ^
        |
        ~@
      ]).freeze

      BINARY_METHOD_OPERATORS = Set.new(
        METHOD_OPERATORS - (INDEX_OPERATORS + UNARY_METHOD_OPERATORS)
      )

      OPERATOR_METHODS = Set.new(
        METHOD_OPERATORS + INDEX_OPERATORS + UNARY_METHOD_OPERATORS
      ).freeze

      # Nodes that are NOT handled by mutant.
      #
      # not - 1.8 only, mutant does not support 1.8
      #
      BLACKLIST = Set.new(%i[not]).freeze

      # Nodes that are NOT generated by parser but used by mutant / unparser.
      GENERATED = Set.new(%i[empty]).freeze

      ALL = Set.new(
        (Parser::Meta::NODE_TYPES + GENERATED) - BLACKLIST
      ).freeze
    end # Types
  end # AST
end # Mutant

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
mutant-0.9.13 lib/mutant/ast/types.rb
mutant-0.9.12 lib/mutant/ast/types.rb
mutant-0.9.11 lib/mutant/ast/types.rb
mutant-0.9.10 lib/mutant/ast/types.rb
mutant-0.9.9 lib/mutant/ast/types.rb
mutant-0.9.8 lib/mutant/ast/types.rb
mutant-0.9.7 lib/mutant/ast/types.rb
mutant-0.9.6 lib/mutant/ast/types.rb
mutant-0.9.5 lib/mutant/ast/types.rb
mutant-0.9.4 lib/mutant/ast/types.rb
mutant-0.9.3 lib/mutant/ast/types.rb
mutant-0.9.2 lib/mutant/ast/types.rb