@@ -48,31 +48,34 @@ pub(crate) fn interface_representation(
48
48
} ;
49
49
let Ok ( ast) = parser. parse_file ( ) . map_err ( |e| e. emit ( ) ) else { return } ;
50
50
for item in ast. items {
51
- if let ItemKind :: Contract ( contract) = & item. kind {
52
- if contract. kind . is_interface ( ) | contract. kind . is_library ( ) {
53
- continue ;
54
- }
55
- for contract_item in contract. body . iter ( ) {
56
- if let ItemKind :: Function ( function) = & contract_item. kind {
57
- let is_exposed = match function. kind {
58
- // Function with external or public visibility
59
- FunctionKind :: Function => {
60
- function. header . visibility >= Some ( Visibility :: Public )
61
- }
62
- FunctionKind :: Constructor
63
- | FunctionKind :: Fallback
64
- | FunctionKind :: Receive => true ,
65
- FunctionKind :: Modifier => false ,
66
- } ;
51
+ let ItemKind :: Contract ( contract) = & item. kind else {
52
+ continue ;
53
+ } ;
67
54
68
- // If function is not exposed we remove the entire span (signature and
69
- // body). Otherwise we keep function signature and
70
- // remove only the body.
71
- if !is_exposed {
72
- spans_to_remove. push ( contract_item. span ) ;
73
- } else {
74
- spans_to_remove. push ( function. body_span ) ;
55
+ if contract. kind . is_interface ( ) || contract. kind . is_library ( ) {
56
+ continue ;
57
+ }
58
+
59
+ for contract_item in contract. body . iter ( ) {
60
+ if let ItemKind :: Function ( function) = & contract_item. kind {
61
+ let is_exposed = match function. kind {
62
+ // Function with external or public visibility
63
+ FunctionKind :: Function => {
64
+ function. header . visibility >= Some ( Visibility :: Public )
75
65
}
66
+ FunctionKind :: Constructor
67
+ | FunctionKind :: Fallback
68
+ | FunctionKind :: Receive => true ,
69
+ FunctionKind :: Modifier => false ,
70
+ } ;
71
+
72
+ // If function is not exposed we remove the entire span (signature and
73
+ // body). Otherwise we keep function signature and
74
+ // remove only the body.
75
+ if !is_exposed {
76
+ spans_to_remove. push ( contract_item. span ) ;
77
+ } else {
78
+ spans_to_remove. push ( function. body_span ) ;
76
79
}
77
80
}
78
81
}
0 commit comments