1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
3
4use crate::Cli;
5use i_slint_compiler::parser::{SyntaxKind, SyntaxNode};
6use std::io::Write;
7
8pub(crate) fn fold_node(
9 node: &SyntaxNode,
10 file: &mut impl Write,
11 _state: &mut crate::State,
12 _args: &Cli,
13) -> std::io::Result<bool> {
14 if node.kind() == SyntaxKind::PropertyDeclaration
15 && node
16 .parent()
17 .and_then(|n| n.parent())
18 .map_or(default:false, |n: SyntaxNode| n.kind() == SyntaxKind::Component)
19 {
20 // check that the first identifier is "property" as opposed to an already converted "in-out" token
21 if node.child_token(SyntaxKind::Identifier).map_or(default:false, |t: SyntaxToken| t.text() == "property") {
22 // Consider that all property are in-out, because we don't do enough analysis in the slint-updater to know
23 // if they should be private
24 write!(file, "in-out ")?;
25 }
26 }
27 Ok(false)
28}
29