Remove unparsing for guarding
* With the monkeypatch to parser it this is not needed anymore. * Mutant will NOT be released with this monkeypatch, I'll try to get it upstream soon. * Performance for the mutation corpus test is greatly improved. * Positive performance chance for regular mutant runs is visible.
This commit is contained in:
parent
a5f56107d8
commit
0010c00c9f
2 changed files with 35 additions and 12 deletions
|
@ -19,6 +19,41 @@ require 'anima'
|
||||||
require 'concord'
|
require 'concord'
|
||||||
require 'morpher'
|
require 'morpher'
|
||||||
|
|
||||||
|
# Monkey patch to parser that needs to be pushed upstream
|
||||||
|
module Parser
|
||||||
|
# AST namespace
|
||||||
|
module AST
|
||||||
|
# The AST nodes we use in mutant
|
||||||
|
class Node
|
||||||
|
|
||||||
|
# Return hash compatible with #eql?
|
||||||
|
#
|
||||||
|
# @return [Fixnum]
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
|
def hash
|
||||||
|
@type.hash ^ @children.hash ^ self.class.hash
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test if node is equal to anotheo
|
||||||
|
#
|
||||||
|
# @return [true]
|
||||||
|
# if node represents the same code semantics locations are ignored
|
||||||
|
#
|
||||||
|
# @return [false]
|
||||||
|
# otherwise
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
|
#
|
||||||
|
def eql?(other)
|
||||||
|
other.kind_of?(self.class)
|
||||||
|
other.type.eql?(@type) && other.children.eql?(@children)
|
||||||
|
end
|
||||||
|
|
||||||
|
end # Node
|
||||||
|
end # AST
|
||||||
|
end # Parser
|
||||||
|
|
||||||
# Library namespace
|
# Library namespace
|
||||||
module Mutant
|
module Mutant
|
||||||
# The frozen empty string used within mutant
|
# The frozen empty string used within mutant
|
||||||
|
|
|
@ -9,18 +9,6 @@ module Mutant
|
||||||
class Node < self
|
class Node < self
|
||||||
include AbstractType, NodeHelpers, Unparser::Constants
|
include AbstractType, NodeHelpers, Unparser::Constants
|
||||||
|
|
||||||
# Return identity of node
|
|
||||||
#
|
|
||||||
# @param [Parser::AST::Node] node
|
|
||||||
#
|
|
||||||
# @return [String]
|
|
||||||
#
|
|
||||||
# @api private
|
|
||||||
#
|
|
||||||
def self.identity(node)
|
|
||||||
Unparser.unparse(node)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Define named child
|
# Define named child
|
||||||
#
|
#
|
||||||
# @param [Symbol] name
|
# @param [Symbol] name
|
||||||
|
|
Loading…
Reference in a new issue