|
|
|
@ -56,18 +56,19 @@ class SBR(AbstractMutator): # pylint: disable=too-few-public-methods |
|
|
|
|
|
|
|
|
|
for function in self.contract.functions_and_modifiers_declared: |
|
|
|
|
for node in function.nodes: |
|
|
|
|
if node.type != NodeType.ENTRYPOINT: |
|
|
|
|
if node.type != NodeType.ENTRYPOINT and node.type != NodeType.ENDIF and node.type != NodeType.ENDLOOP: |
|
|
|
|
# Get the string |
|
|
|
|
start = node.source_mapping.start |
|
|
|
|
stop = start + node.source_mapping.length |
|
|
|
|
old_str = self.in_file_str[start:stop] |
|
|
|
|
line_no = node.source_mapping.lines |
|
|
|
|
for value in solidity_rules: |
|
|
|
|
left_value = value.split(" ==> ")[0] |
|
|
|
|
right_value = value.split(" ==> ")[1] |
|
|
|
|
if re.search(re.compile(left_value), old_str) != None: |
|
|
|
|
new_str = re.sub(re.compile(left_value), right_value, old_str) |
|
|
|
|
create_patch_with_line(result, self.in_file, start, stop, old_str, new_str, line_no[0]) |
|
|
|
|
if not line_no[0] in self.dont_mutate_line: |
|
|
|
|
for value in solidity_rules: |
|
|
|
|
left_value = value.split(" ==> ")[0] |
|
|
|
|
right_value = value.split(" ==> ")[1] |
|
|
|
|
if re.search(re.compile(left_value), old_str) != None: |
|
|
|
|
new_str = re.sub(re.compile(left_value), right_value, old_str) |
|
|
|
|
create_patch_with_line(result, self.in_file, start, stop, old_str, new_str, line_no[0]) |
|
|
|
|
|
|
|
|
|
for variable in self.contract.state_variables_declared: |
|
|
|
|
node = variable.node_initialization |
|
|
|
@ -76,12 +77,13 @@ class SBR(AbstractMutator): # pylint: disable=too-few-public-methods |
|
|
|
|
stop = start + node.source_mapping.length |
|
|
|
|
old_str = self.in_file_str[start:stop] |
|
|
|
|
line_no = node.source_mapping.lines |
|
|
|
|
for value in solidity_rules: |
|
|
|
|
left_value = value.split(" ==> ")[0] |
|
|
|
|
right_value = value.split(" ==> ")[1] |
|
|
|
|
if re.search(re.compile(left_value), old_str) != None: |
|
|
|
|
new_str = re.sub(re.compile(left_value), right_value, old_str) |
|
|
|
|
create_patch_with_line(result, self.in_file, start, stop, old_str, new_str, line_no[0]) |
|
|
|
|
if not line_no[0] in self.dont_mutate_line: |
|
|
|
|
for value in solidity_rules: |
|
|
|
|
left_value = value.split(" ==> ")[0] |
|
|
|
|
right_value = value.split(" ==> ")[1] |
|
|
|
|
if re.search(re.compile(left_value), old_str) != None: |
|
|
|
|
new_str = re.sub(re.compile(left_value), right_value, old_str) |
|
|
|
|
create_patch_with_line(result, self.in_file, start, stop, old_str, new_str, line_no[0]) |
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|