Skip to content

Commit 7d0edb8

Browse files
committed
Review changes
1 parent 3105272 commit 7d0edb8

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

crates/compilers/src/preprocessor.rs

+26-23
Original file line numberDiff line numberDiff line change
@@ -48,31 +48,34 @@ pub(crate) fn interface_representation(
4848
};
4949
let Ok(ast) = parser.parse_file().map_err(|e| e.emit()) else { return };
5050
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+
};
6754

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)
7565
}
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);
7679
}
7780
}
7881
}

0 commit comments

Comments
 (0)