mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
First stage of cleaning up the export handling of the slint root component (#2095)
We implicitly export the last component of a .slint file to the generator. Issue a warning when that happens and suggest to export it explicitly.
This commit is contained in:
parent
33d68687c2
commit
24dcef5fed
130 changed files with 175 additions and 143 deletions
|
@ -200,7 +200,7 @@ pub struct UsedSubTypes {
|
|||
/// Or is materialized for repeated expression.
|
||||
#[derive(Default, Debug)]
|
||||
pub struct Component {
|
||||
// node: SyntaxNode,
|
||||
pub node: Option<SyntaxNode>,
|
||||
pub id: String,
|
||||
pub root_element: ElementRc,
|
||||
|
||||
|
@ -254,6 +254,7 @@ impl Component {
|
|||
let mut child_insertion_point = None;
|
||||
let is_legacy_syntax = node.child_token(SyntaxKind::ColonEqual).is_some();
|
||||
let c = Component {
|
||||
node: Some(node.clone().into()),
|
||||
id: parser::identifier_text(&node.DeclaredIdentifier()).unwrap_or_default(),
|
||||
root_element: Element::from_node(
|
||||
node.Element(),
|
||||
|
@ -2215,6 +2216,15 @@ impl Exports {
|
|||
|
||||
if sorted_deduped_exports.is_empty() {
|
||||
if let Some(last_compo) = inner_components.last() {
|
||||
if last_compo.is_global() {
|
||||
diag.push_warning(
|
||||
"Global singleton is implicitly marked for export. This is deprecated and it should be explicitly exported"
|
||||
.into(),
|
||||
&last_compo.node,
|
||||
);
|
||||
} else {
|
||||
diag.push_warning("Component is implicitly marked for export. This is deprecated and it should be explicitly exported".into(), &last_compo.node)
|
||||
}
|
||||
let name = last_compo.id.clone();
|
||||
sorted_deduped_exports.push((
|
||||
ExportedName { name, name_ident: doc.clone().into() },
|
||||
|
|
|
@ -268,6 +268,7 @@ fn duplicate_sub_component(
|
|||
) -> Rc<Component> {
|
||||
debug_assert!(component_to_duplicate.parent_element.upgrade().is_some());
|
||||
let new_component = Component {
|
||||
node: component_to_duplicate.node.clone(),
|
||||
id: component_to_duplicate.id.clone(),
|
||||
root_element: duplicate_element_with_mapping(
|
||||
&component_to_duplicate.root_element,
|
||||
|
|
|
@ -19,7 +19,7 @@ Button3 := Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
Test := Window {
|
||||
export Test := Window {
|
||||
|
||||
Button1 { }
|
||||
Button1 { accessible-description: "ok"; } // ok because Button1 has a role
|
||||
|
|
|
@ -14,7 +14,7 @@ WithStates := Rectangle {
|
|||
]
|
||||
}
|
||||
|
||||
Test := Rectangle {
|
||||
export Test := Rectangle {
|
||||
|
||||
property <int> a: 45 + root.b;
|
||||
// ^error{The binding for the property 'a' is part of a binding loop}
|
||||
|
|
|
@ -35,7 +35,7 @@ T4 := Rectangle {
|
|||
property <length> my_property <=> x;
|
||||
}
|
||||
|
||||
App := Rectangle {
|
||||
export App := Rectangle {
|
||||
|
||||
|
||||
VerticalLayout {
|
||||
|
|
|
@ -18,7 +18,7 @@ Compo1 := Rectangle {
|
|||
// ^error{The binding for the property 'bb' is part of a binding loop}
|
||||
}
|
||||
|
||||
App := Rectangle {
|
||||
export App := Rectangle {
|
||||
cc := Compo1 {
|
||||
aa() => { return self.a; }
|
||||
// ^error{The binding for the property 'aa' is part of a binding loop}
|
||||
|
@ -29,4 +29,4 @@ App := Rectangle {
|
|||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ Alias := Rectangle {
|
|||
property <int> ps_width <=> viewport_width;
|
||||
}
|
||||
|
||||
Foo := Rectangle {
|
||||
export Foo := Rectangle {
|
||||
property <int> base-prop: alias.viewport_width;
|
||||
// ^error{The binding for the property 'base-prop' is part of a binding loop}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ TC := Rectangle {
|
|||
}
|
||||
|
||||
|
||||
Test := Rectangle {
|
||||
export 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}
|
||||
|
|
|
@ -26,7 +26,7 @@ Wrap := Rectangle {
|
|||
property <bool> test: square.width == square.height;
|
||||
}
|
||||
|
||||
Test := Rectangle {
|
||||
export Test := Rectangle {
|
||||
property <image> source;
|
||||
GridLayout {
|
||||
// ^error{The binding for the property 'layout-cache-h' is part of a binding loop}
|
||||
|
|
|
@ -22,7 +22,7 @@ Compo := Rectangle {
|
|||
|
||||
}
|
||||
|
||||
Foo := Rectangle {
|
||||
export Foo := Rectangle {
|
||||
Compo {
|
||||
// ^error{The binding for the property 'preferred-width' is part of a binding loop}
|
||||
the_text: self.preferred-width / 1px;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
Key := Rectangle { property <int> pos; property <int> num_elements; }
|
||||
|
||||
Test := Rectangle {
|
||||
export Test := Rectangle {
|
||||
Rectangle {
|
||||
property <int> num_elements;
|
||||
num-elements: 4;
|
||||
|
|
|
@ -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 {
|
||||
|
||||
animate x {
|
||||
duration: 1000ms;
|
||||
|
|
|
@ -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 {
|
||||
property<duration> p1: 3s + 1ms;
|
||||
property<int> p2: 3s + 1;
|
||||
// ^error{Cannot convert float to duration}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Test := Window {
|
||||
export Test := Window {
|
||||
a: [,];
|
||||
// ^error{invalid expression}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
TouchArea {
|
||||
clicked => { root.x = 1phx; }
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ Foo := Rectangle {
|
|||
drop-shadow-color: red;
|
||||
}
|
||||
|
||||
SuperSimple := Window {
|
||||
export SuperSimple := Window {
|
||||
drop-shadow-color: #00000080;
|
||||
// ^warning{The drop-shadow-color property cannot be used on the root element, the shadow will not be visible}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ TestBox2 := Rectangle {
|
|||
// ^error{The @children placeholder can only appear once in an element hierarchy}
|
||||
}
|
||||
|
||||
Final := TestBox {
|
||||
export Final := TestBox {
|
||||
Rectangle {
|
||||
@children
|
||||
// ^error{children placeholder not allowed in the final component}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Final := Window {
|
||||
export Final := Window {
|
||||
VerticalLayout {
|
||||
@children
|
||||
// ^error{children placeholder not allowed in the final component}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
MyTouchArea := TouchArea { }
|
||||
|
||||
SubElements := Rectangle {
|
||||
export SubElements := Rectangle {
|
||||
Rectangle {
|
||||
clip: 42;
|
||||
// ^error{Cannot convert float to bool}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// comment
|
||||
|
||||
// line comment
|
||||
SuperSimple := Rectangle {
|
||||
export SuperSimple := Rectangle {
|
||||
/* block comment */
|
||||
background: green;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
property<bool> zz: aa > bb == cc
|
||||
// ^error{Use parentheses to disambiguate equality expression on the same level}
|
||||
< dd;
|
||||
|
|
|
@ -26,7 +26,7 @@ SuperSimple := Rectangle {
|
|||
}
|
||||
|
||||
|
||||
Test2 := Rectangle {
|
||||
export Test2 := Rectangle {
|
||||
background: {
|
||||
// ^error{Cannot convert void to brush}
|
||||
if (true) {
|
||||
|
|
|
@ -47,7 +47,7 @@ MyDialog4 := Dialog {
|
|||
}
|
||||
}
|
||||
|
||||
Test := Rectangle {
|
||||
export Test := Rectangle {
|
||||
MyDiag1 {}
|
||||
MyDiag2 {}
|
||||
MyDiag3 {}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
import { StandardButton } from "std-widgets.slint";
|
||||
|
||||
Test := Dialog {
|
||||
// ^error{A Dialog must have a single child element that is not StandardButton}
|
||||
export Test := Dialog {
|
||||
// ^error{A Dialog must have a single child element that is not StandardButton}
|
||||
StandardButton { kind: ok; }
|
||||
StandardButton { }
|
||||
// ^error{The `kind` property of the StandardButton in a Dialog must be set}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
|
||||
x: 42phx;
|
||||
x: 32phx;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
SuperSimple := Rectangle {
|
||||
export SuperSimple := Rectangle {
|
||||
background: green;
|
||||
background: red;
|
||||
// ^error{Duplicated property}
|
||||
|
|
|
@ -26,7 +26,7 @@ SubElement := Rectangle {
|
|||
// ^error{duplicated element id 'hello'}
|
||||
}
|
||||
|
||||
TestCase := Rectangle {
|
||||
export TestCase := Rectangle {
|
||||
|
||||
unique := Rectangle {
|
||||
foo := SubElement { }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
animate x { easing: ease-in; }
|
||||
animate y { easing: foo; }
|
||||
// ^error{Unknown unqualified identifier 'foo'}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
// Cannot be put in the easing.slint test because it is in a different pass
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
property <int> g; animate g { easing: cubic-bezier; }
|
||||
// ^error{must be called}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
SuperSimple := Rectangle {
|
||||
export SuperSimple := Rectangle {
|
||||
background: green;
|
||||
|
||||
for xx Text {}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
SubElements := Rectangle {
|
||||
export SubElements := Rectangle {
|
||||
|
||||
background: blue;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Inline1 := Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
SubElements := Rectangle {
|
||||
export SubElements := Rectangle {
|
||||
Inline1 {
|
||||
background: yellow;
|
||||
invalid: yellow;
|
||||
|
|
|
@ -19,7 +19,7 @@ Comp := Rectangle {
|
|||
// ^error{'Rectangle' is not a valid type}
|
||||
}
|
||||
|
||||
Foo := Rectangle {
|
||||
export Foo := Rectangle {
|
||||
xx := Rectangle { }
|
||||
Comp {
|
||||
r: xx;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
|
||||
lay := GridLayout {
|
||||
property<string> foo: "hello";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
|
||||
lay := GridLayout {
|
||||
property<string> foo: "hello";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
property<brush> g1: @linear-gradient();
|
||||
// ^error{Expected angle expression}
|
||||
property<brush> g2: @linear-gradient(to left, blue, red);
|
||||
|
|
|
@ -6,7 +6,7 @@ global Plop := {
|
|||
// ^error{Builtin function must be called}
|
||||
}
|
||||
|
||||
SuperSimple := Rectangle {
|
||||
export SuperSimple := Rectangle {
|
||||
property <int> a: max + max() + max(45, "hello");
|
||||
// ^error{Builtin function must be called}
|
||||
// ^^error{Needs at least one argument}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
H := Rectangle {
|
||||
export H := Rectangle {
|
||||
x: {foo: "42"};
|
||||
// ^error{Cannot convert \{ foo: string,\} to length}
|
||||
y: [ 45, 45, 45, 45 ];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
SuperSimple := Window {
|
||||
export SuperSimple := Window {
|
||||
|
||||
opacity: 0.5;
|
||||
// ^warning{The opacity property cannot be used on the root element, it will not be applied}
|
||||
|
|
|
@ -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 {
|
||||
88;
|
||||
// ^error{Parse error}
|
||||
* / - + // no error there as this is already reported in the previous line
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
TestCase := Rectangle {
|
||||
export TestCase := Rectangle {
|
||||
Path {
|
||||
LineTo { x: 100; y: 0; }
|
||||
LineTo { x: 100; y: 0; }
|
||||
|
|
|
@ -8,7 +8,7 @@ Test2 := Path {
|
|||
// ^error{Error parsing SVG commands}
|
||||
}
|
||||
|
||||
TestCase := Rectangle {
|
||||
export TestCase := Rectangle {
|
||||
Path {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
TestCase := Rectangle {
|
||||
export TestCase := Rectangle {
|
||||
Path {
|
||||
MoveTo {
|
||||
x: 0;
|
||||
|
|
|
@ -12,7 +12,7 @@ Foo := Rectangle {
|
|||
// ^error{conversion from percentage to length is only possible for the properties width and height}
|
||||
}
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
height: 30%;
|
||||
// ^error{Cannot find parent property to apply relative length}
|
||||
Foo {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
X := PopupWindow {
|
||||
// ^error{PopupWindow cannot be the top level}
|
||||
export X := PopupWindow {
|
||||
// ^error{PopupWindow cannot be the top level}
|
||||
|
||||
Rectangle {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
animate x {
|
||||
duration: 1000ms;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ Comp := Rectangle {
|
|||
callback pressed;
|
||||
}
|
||||
|
||||
Test := Comp {
|
||||
export Test := Comp {
|
||||
property<int> foo;
|
||||
foo: 100;
|
||||
property<NonExistent> bar;
|
||||
|
|
|
@ -5,7 +5,7 @@ Comp := Rectangle {
|
|||
property<int> prop;
|
||||
}
|
||||
|
||||
Test := Rectangle {
|
||||
export Test := Rectangle {
|
||||
Comp {
|
||||
prop: 45;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
property<brush> g1: @radial-gradient();
|
||||
// ^error{Expected 'circle': currently, only @radial-gradient\(circle, ...\) are supported}
|
||||
property<brush> g2: @radial-gradient(circle at 100%, #333, #333 50%, #eee 75%, #333 75%);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
background: {
|
||||
return 42;
|
||||
// ^error{Cannot convert float to brush}
|
||||
|
|
|
@ -47,7 +47,7 @@ Ex2 := Rectangle {
|
|||
}
|
||||
|
||||
|
||||
Ex3 := Rectangle {
|
||||
export Ex3 := Rectangle {
|
||||
i1 := Image {
|
||||
// ^error{Elements with rotation properties cannot have children elements}
|
||||
Rectangle {}
|
||||
|
|
|
@ -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 {
|
||||
TouchArea {
|
||||
clicked => { root.x += 1phx; }
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ Base := Rectangle {
|
|||
callback blah;
|
||||
}
|
||||
|
||||
SubElements := Rectangle {
|
||||
export SubElements := Rectangle {
|
||||
callback foobar;
|
||||
callback foobar;
|
||||
// ^error{Duplicated callback declaration}
|
||||
|
|
|
@ -87,7 +87,7 @@ component NewSyntax {
|
|||
|
||||
}
|
||||
|
||||
component OldInNewSyntax {
|
||||
export component OldInNewSyntax {
|
||||
property<bool> checked;
|
||||
property <int> border;
|
||||
property <color> color;
|
||||
|
@ -130,4 +130,4 @@ component OldInNewSyntax {
|
|||
text := Text {}
|
||||
touch := TouchArea {}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
animate background { }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Test := Window {
|
||||
export Test := Window {
|
||||
Text {
|
||||
text: "hel\lo";
|
||||
// ^error{Cannot parse string literal}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
SubElements := Rectangle {
|
||||
export SubElements := Rectangle {
|
||||
|
||||
Rectangle {
|
||||
background: yellow;
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
SuperSimple := Rectangle {
|
||||
export SuperSimple := Rectangle {
|
||||
background: green;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
TestCase := Rectangle {
|
||||
export TestCase := Rectangle {
|
||||
Path {
|
||||
commands: "M 350 300 L 550 300 ";
|
||||
LineTo { x: 10; y: 100; }
|
||||
|
|
|
@ -30,7 +30,7 @@ global MyType := {
|
|||
|
||||
}
|
||||
|
||||
SuperSimple := Rectangle {
|
||||
export SuperSimple := Rectangle {
|
||||
MyType {
|
||||
// ^error{Cannot create an instance of a global component}
|
||||
ccc: "hello";
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
struct Struct := { def: int, }
|
||||
|
||||
SuperSimple := Rectangle {
|
||||
export SuperSimple := Rectangle {
|
||||
DoesNotExist {
|
||||
// ^error{Unknown type DoesNotExist}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ global Singleton := {
|
|||
// ^error{A global component cannot have an 'init' callback}
|
||||
}
|
||||
|
||||
Test := Rectangle {
|
||||
export Test := Rectangle {
|
||||
callback init;
|
||||
// ^error{Cannot override callback 'init'}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ Foo := Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
Bar := Rectangle {
|
||||
export Bar := Rectangle {
|
||||
Foo { Text {} }
|
||||
ListView {
|
||||
Text {}
|
||||
|
@ -32,4 +32,4 @@ Bar := Rectangle {
|
|||
for x in 2: Rectangle {}
|
||||
// ^warning{A ListView can just have a single 'for' as children. Anything else is not supported}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
import { TabWidget } from "std-widgets.slint";
|
||||
Test1 := Rectangle {
|
||||
export Test1 := Rectangle {
|
||||
TabWidget {
|
||||
Rectangle {}
|
||||
// ^error{Rectangle is not allowed within TabWidget. Only Tab are valid children}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import { TabWidget } from "std-widgets.slint";
|
||||
|
||||
Test2 := Rectangle {
|
||||
export Test2 := Rectangle {
|
||||
TabWidget {
|
||||
Tab {
|
||||
visible: false;
|
||||
|
|
|
@ -7,5 +7,5 @@ Test3 := Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
Foo := TabWidget { }
|
||||
// ^error{Unknown type TabWidget. \(The type exist as an internal type, but cannot be accessed in this scope\)}
|
||||
export Foo := TabWidget { }
|
||||
// ^error{Unknown type TabWidget. \(The type exist as an internal type, but cannot be accessed in this scope\)}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
component Button {
|
||||
|
||||
}
|
||||
|
||||
component App {
|
||||
//^warning{Component is implicitly marked for export. This is deprecated and it should be explicitly exported}
|
||||
Button {}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
global Settings {
|
||||
//^warning{Global singleton is implicitly marked for export. This is deprecated and it should be explicitly exported}
|
||||
in-out property <bool> active;
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
forward-focus: nothingness;
|
||||
// ^error{Unknown unqualified identifier}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
edit := TextInput { }
|
||||
TouchArea {
|
||||
clicked => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
forward-focus: someRect;
|
||||
// ^error{element is not focusable}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Abc := Rectangle {
|
|||
function par() {}
|
||||
}
|
||||
|
||||
Xxx := Rectangle {
|
||||
export Xxx := Rectangle {
|
||||
function fooo(a: int, a: int) -> int { return a; }
|
||||
// ^error{Duplicated argument name 'a'}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ Comp := Rectangle {
|
|||
public function f2() {}
|
||||
}
|
||||
|
||||
Xxx := Rectangle {
|
||||
export Xxx := Rectangle {
|
||||
function foo(a: int) -> string { return a; }
|
||||
|
||||
comp := Comp {}
|
||||
|
|
|
@ -138,7 +138,7 @@ Foo_Legacy := Rectangle {
|
|||
}
|
||||
|
||||
|
||||
Bar_Legacy := Rectangle {
|
||||
export Bar_Legacy := Rectangle {
|
||||
pure callback xc1 <=> f.c1;
|
||||
// ^error{Purity of callbacks 'xc1' and 'f.c1' doesn't match}
|
||||
callback xc2 <=> f.c2;
|
||||
|
@ -149,4 +149,4 @@ Bar_Legacy := Rectangle {
|
|||
// ^warning{Call of impure callback 'c1'}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import { Rec12 } from "../../typeloader/recursive_import1.slint";
|
||||
// ^error{No exported type called 'Rec12' found in ".*recursive_import1.slint"}
|
||||
Blah := Rec12 {
|
||||
// ^error{Unknown type Rec12}
|
||||
export Blah := Rec12 {
|
||||
// ^error{Unknown type Rec12}
|
||||
width: 100px;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import { LineEdit } from "sixtyfps_widgets.60";
|
|||
// ^warning{"sixtyfps_widgets\.60" was renamed "std-widgets\.slint". Use of the old file name is deprecated}
|
||||
|
||||
|
||||
Blah := Window {
|
||||
export Blah := Window {
|
||||
LineEdit {} // Not an error
|
||||
Button {} // Not imported
|
||||
// ^error{Unknown type Button}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import { X } from "../../typeloader/incpath/should_fail2.slint";
|
||||
|
||||
Foo := Rectangle {
|
||||
export Foo := Rectangle {
|
||||
x:= X {
|
||||
hello: 42;
|
||||
meh: 12;
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
|
||||
import { Y } from "../../typeloader/incpath/should_fail3.slint";
|
||||
|
||||
Foo := Rectangle {
|
||||
export Foo := Rectangle {
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import { Z } from "../../typeloader/incpath/should_fail4.slint";
|
||||
|
||||
Foo := Rectangle {
|
||||
export Foo := Rectangle {
|
||||
Z {
|
||||
property <int> b: b1;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@ import { SomeRect } from "../../typeloader/incpath/local_helper_type.slint";
|
|||
import "../../typeloader/incpath/local_helper_type.slint";
|
||||
// ^error{Import names are missing. Please specify which types you would like to import}
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,6 @@ import "myimage.png";
|
|||
import ".";
|
||||
// ^error{Unsupported foreign import ".*"}
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@ import { NotExported } from "../../typeloader/incpath/local_helper_type.slint";
|
|||
import { } from "../../typeloader/incpath/local_helper_type.slint";
|
||||
// ^error{Import names are missing. Please specify which types you would like to import}
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,6 @@ export { Image as Plop }
|
|||
export { string as Boob }
|
||||
// ^error{Cannot export 'string' because it is not a component}
|
||||
|
||||
Hello := Plop {
|
||||
// ^error{Unknown type Plop}
|
||||
export Hello := Plop {
|
||||
// ^error{Unknown type Plop}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import { SomeRect } from "../../typeloader/incpath/local_helper_type.slint";
|
|||
|
||||
import { X } from "../../typeloader/incpath/should_fail.slint";
|
||||
|
||||
Blah := X {
|
||||
export Blah := X {
|
||||
width: 100px;
|
||||
// ^error{Unknown property width in X}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Test := Rectangle {
|
||||
export Test := Rectangle {
|
||||
property <bool> condition;
|
||||
|
||||
GridLayout {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Test := Rectangle {
|
||||
export Test := Rectangle {
|
||||
|
||||
GridLayout {
|
||||
Rectangle {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Hello := Rectangle {
|
||||
export Hello := Rectangle {
|
||||
|
||||
property <int> aa: 45;
|
||||
property <{o:[int], c:string}> bb;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Xxx := Rectangle {
|
||||
export Xxx := Rectangle {
|
||||
|
||||
foo := Rectangle {
|
||||
callback hello(int) -> int;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Xxx := Rectangle {
|
||||
export Xxx := Rectangle {
|
||||
|
||||
foo := Rectangle {
|
||||
callback hello(int) -> int;
|
||||
|
|
|
@ -6,7 +6,7 @@ Sub := Rectangle {
|
|||
callback compute_alias <=> compute;
|
||||
}
|
||||
|
||||
Xxx := Rectangle {
|
||||
export Xxx := Rectangle {
|
||||
|
||||
foo := Rectangle {
|
||||
callback hello(int) -> int;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Xxx := Rectangle {
|
||||
export Xxx := Rectangle {
|
||||
callback plop() -> string;
|
||||
plop => {}
|
||||
// ^error{Cannot convert void to string}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
Rectangle {
|
||||
background: blue;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ global Glob := {
|
|||
property <relative-font-size> rem_allowed: 42rem;
|
||||
}
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
|
||||
t := Text {
|
||||
x: "hello";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Xxx := Rectangle {
|
||||
export Xxx := Rectangle {
|
||||
|
||||
my-rect := Rectangle {
|
||||
border-width: 44px;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Xxx := Rectangle {
|
||||
export Xxx := Rectangle {
|
||||
color: white;
|
||||
// ^warning{The property 'color' has been deprecated. Please use 'background' instead}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
TestCase := Text {
|
||||
export TestCase := Text {
|
||||
// allow unqualified enum when we can infer the type from the property assigned to
|
||||
horizontal-alignment: right;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Hello := Rectangle {
|
||||
export Hello := Rectangle {
|
||||
|
||||
aaa := Text{ text: "aaa";
|
||||
bbb := Text{ text: "bbb"; }
|
||||
|
|
|
@ -16,7 +16,7 @@ global my_lowercase := {
|
|||
}
|
||||
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
x: MyGlobal.custom_prop;
|
||||
background: MyGlobal.blue;
|
||||
// ^error{'MyGlobal' does not have a property 'blue'}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
||||
|
||||
Hello := Rectangle {
|
||||
export Hello := Rectangle {
|
||||
|
||||
width: 100phx;
|
||||
height: 100phx;
|
||||
|
|
|
@ -15,7 +15,7 @@ Comp := Rectangle {
|
|||
}
|
||||
|
||||
|
||||
X := Rectangle {
|
||||
export X := Rectangle {
|
||||
width: 50phx;
|
||||
height: width;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue