From 8335faae8b72d19d02cbcac334e7f52c12257df5 Mon Sep 17 00:00:00 2001 From: David Pokora Date: Wed, 6 Feb 2019 14:21:45 -0500 Subject: [PATCH] * Numbered edges in inheritance-graph to denote order of inheritance. * Temporarily tweaked again to highlight shadowing functions instead of shadowed. --- slither/printers/inheritance/inheritance_graph.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/slither/printers/inheritance/inheritance_graph.py b/slither/printers/inheritance/inheritance_graph.py index e8c9d2fba..d5f569a55 100644 --- a/slither/printers/inheritance/inheritance_graph.py +++ b/slither/printers/inheritance/inheritance_graph.py @@ -42,7 +42,7 @@ class PrinterInheritanceGraph(AbstractPrinter): func_name = func.full_name pattern = ' %s' pattern_shadow = ' %s' - if func in self.overshadowed_functions: + if func in self.overshadowing_functions: return pattern_shadow % func_name return pattern % func_name @@ -65,9 +65,12 @@ class PrinterInheritanceGraph(AbstractPrinter): Build summary using HTML """ ret = '' - # Add arrows - for i in contract.immediate_inheritance: - ret += '%s -> %s;\n' % (contract.name, i) + # Add arrows (number them if there is more than one path so we know order of declaration for inheritance). + if len(contract.immediate_inheritance) == 1: + ret += '%s -> %s;\n' % (contract.name, contract.immediate_inheritance[0]) + else: + for i in range(0, len(contract.immediate_inheritance)): + ret += '%s -> %s [ label="%s" ];\n' % (contract.name, contract.immediate_inheritance[i], i + 1) # Functions visibilities = ['public', 'external']