mirror of
https://github.com/slint-ui/slint.git
synced 2025-07-24 13:35:00 +00:00

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.
38 lines
950 B
Text
38 lines
950 B
Text
|
|
|
|
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
|
|
|
|
|
|
|
|
Comp := Rectangle {
|
|
function f1() {}
|
|
public function f2() {}
|
|
}
|
|
|
|
export Xxx := Rectangle {
|
|
function foo(a: int) -> string { return a; }
|
|
|
|
comp := Comp {}
|
|
|
|
function bar() {
|
|
foo(45, 45);
|
|
// ^error{The callback or function expects 1 arguments, but 2 are provided}
|
|
|
|
foo.hello(45);
|
|
// ^error{Cannot access fields of a function}
|
|
|
|
root.foo();
|
|
// ^error{The callback or function expects 1 arguments, but 0 are provided}
|
|
|
|
root.foo.hello(45);
|
|
// ^error{Cannot access fields of a function}
|
|
|
|
comp.f1();
|
|
// ^error{The function 'f1' is private. Annotate it with 'public' to make it accessible from other components}
|
|
comp.f2();
|
|
}
|
|
|
|
callback xx <=> foo;
|
|
// ^error{Binding to callback 'xx' must bind to another callback}
|
|
}
|