Warn about components that are neither used nor exported

This commit is contained in:
Simon Hausmann 2023-01-26 14:34:08 +01:00 committed by Simon Hausmann
parent 448b216bd8
commit 9180704d70
11 changed files with 62 additions and 25 deletions

View file

@ -1,14 +1,14 @@
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
NotInIf := Rectangle {
export NotInIf := Rectangle {
if true: Rectangle {
@children
// ^error{The @children placeholder cannot appear in a conditional element}
}
}
NotInFor := Rectangle {
export NotInFor := Rectangle {
HorizontalLayout {
for xxx in 12: Rectangle {
VerticalLayout {
@ -25,7 +25,7 @@ TestBox := Rectangle {
// ^error{The @children placeholder can only appear once in an element}
}
TestBox2 := Rectangle {
export TestBox2 := Rectangle {
Rectangle {
@children
}

View file

@ -1,7 +1,7 @@
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
SuperSimple := Rectangle {
export SuperSimple := Rectangle {
background: area.pressed ? green : blue;
property<color> c2: area.pressed ? 123 : 456;
// ^error{Cannot convert float to color}

View file

@ -1,7 +1,7 @@
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
Ex1 := Rectangle {
export Ex1 := Rectangle {
Rectangle {
rotation-origin-x: width / 2;
rotation-angle: 45deg;
@ -25,7 +25,7 @@ ImageWithChild := Image {
Rectangle {}
}
Ex2 := Rectangle {
export Ex2 := Rectangle {
Image {
// ^error{Elements with rotation properties cannot have children elements}
rotation-angle: 45deg;

View file

@ -1,7 +1,7 @@
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
TestCase := Rectangle {
export TestCase := Rectangle {
property<bool> checked;
property <int> border;
states [
@ -46,7 +46,7 @@ TestCase := Rectangle {
}
component NewSyntax {
export component NewSyntax {
property<bool> checked;
property <int> border;
property <color> color;