slint/sixtyfps_compiler/tests/syntax/analysis/binding_loop_layout.60
Olivier Goffart dd3fa1c221 Make the BindingMap hold RefCell of the BindingExpression
This will allow later to be able to operate on the binding despite the
element is borrowed.

Since the Binding itself is in a RefCell, the analysis don't need to
be anymore.
To do this change, a small change in the binding_analysis logic was required
which means that we will now detect binding loop if a binding was causing
two binding loop. (before, only one binding loop was detected)
2021-11-11 11:14:59 +01:00

58 lines
2.6 KiB
Text

/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
TC := Rectangle {
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop}
outer := VerticalLayout {
// ^error{The binding for the property 'width' is part of a binding loop}
// ^^error{The binding for the property 'layoutinfo-h' is part of a binding loop}
inner := HorizontalLayout {
// ^error{The binding for the property 'width' is part of a binding loop}
// ^^error{The binding for the property 'layoutinfo-h' is part of a binding loop}
inner_inner := VerticalLayout {
width: parent.width;
// ^error{The binding for the property 'width' is part of a binding loop}
Rectangle {}
}
}
}
}
Test := Rectangle {
VerticalLayout {
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop} // FIXME: That's an internal property, but people might understand
// ^^error{The binding for the property 'min-width' is part of a binding loop}
Rectangle {
width: parent.min_width;
// ^error{The binding for the property 'width' is part of a binding loop}
}
}
l := HorizontalLayout {
// ^error{The binding for the property 'layoutinfo-h' is part of a binding loop} // FIXME: That's an internal property, but people might understand
// ^^error{The binding for the property 'preferred-width' is part of a binding loop}
// ^^^error{The binding for the property 'layoutinfo-v' is part of a binding loop}
// ^^^^error{The binding for the property 'preferred-height' is part of a binding loop}
// ^^^^^error{The binding for the property 'width' is part of a binding loop}
// ^^^^^^error{The binding for the property 'layout-cache' is part of a binding loop}
Text {
text: "hello \{l.preferred-width/1px}x\{l.preferred-height/1px}";
// ^error{The binding for the property 'text' is part of a binding loop}
}
}
tc := TC {
// ^error{The binding for the property 'preferred-width' is part of a binding loop}
width: preferred-width;
// ^error{The binding for the property 'width' is part of a binding loop}
}
}