forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
198 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* LICENSE BEGIN | ||
This file is part of the SixtyFPS Project -- https://sixtyfps.io | ||
Copyright (c) 2020 Olivier Goffart <[email protected]> | ||
Copyright (c) 2020 Simon Hausmann <[email protected]> | ||
SPDX-License-Identifier: GPL-3.0-only | ||
This file is also available under commercial licensing terms. | ||
Please contact [email protected] for more information. | ||
LICENSE END */ | ||
|
||
use crate::diagnostics::BuildDiagnostics; | ||
use crate::expression_tree::Expression; | ||
use crate::object_tree::{recurse_elem, visit_element_expressions}; | ||
|
||
/// Check the validity of expressions | ||
/// | ||
/// - Make sure that there is no uncalled member function or macro | ||
pub fn check_expressions(doc: &crate::object_tree::Document, diag: &mut BuildDiagnostics) { | ||
for component in &doc.inner_components { | ||
recurse_elem(&component.root_element, &(), &mut |elem, _| { | ||
visit_element_expressions(elem, |e, _, _| check_expression(e, diag)); | ||
}) | ||
} | ||
} | ||
|
||
fn check_expression(e: &Expression, diag: &mut BuildDiagnostics) -> () { | ||
match e { | ||
Expression::MemberFunction { base_node, .. } => { | ||
diag.push_error("Member function must be called".into(), base_node); | ||
} | ||
Expression::BuiltinMacroReference(_, node) => { | ||
diag.push_error("Builtin function must be called".into(), node); | ||
} | ||
_ => e.visit(|e| check_expression(e, diag)), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* LICENSE BEGIN | ||
This file is part of the SixtyFPS Project -- https://sixtyfps.io | ||
Copyright (c) 2020 Olivier Goffart <[email protected]> | ||
Copyright (c) 2020 Simon Hausmann <[email protected]> | ||
|
||
SPDX-License-Identifier: GPL-3.0-only | ||
This file is also available under commercial licensing terms. | ||
Please contact [email protected] for more information. | ||
LICENSE END */ | ||
|
||
X := Rectangle { | ||
animate x { easing: ease-in; } | ||
animate y { easing: foo; } | ||
// ^error{Unknown unqualified identifier 'foo'} | ||
animate color { easing: a; } | ||
// ^error{Cannot convert int to easing} | ||
property <int> a; animate a { easing: cubic-bezier(0.01,1.46,0.94,1.37); } | ||
property <int> b; animate b { easing: cubic-bezier(0.01,1.46,0.94); } | ||
// ^error{Not enough arguments} | ||
property <int> c; animate c { easing: cubic-bezier(); } | ||
// ^error{Not enough arguments} | ||
property <int> d; animate d { easing: cubic-bezier(0,0,0,0,0,0); } | ||
// ^error{Too many argument for bezier curve} | ||
property <int> e; animate e { easing: cubic-bezier(0, a, b, c); } | ||
// ^error{Arguments to cubic bezier curve must be number literal} | ||
property <int> f; animate f { easing: cubic-bezier(0,0+0,0,0,0); } | ||
// ^error{Arguments to cubic bezier curve must be number literal} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* LICENSE BEGIN | ||
This file is part of the SixtyFPS Project -- https://sixtyfps.io | ||
Copyright (c) 2020 Olivier Goffart <[email protected]> | ||
Copyright (c) 2020 Simon Hausmann <[email protected]> | ||
|
||
SPDX-License-Identifier: GPL-3.0-only | ||
This file is also available under commercial licensing terms. | ||
Please contact [email protected] for more information. | ||
LICENSE END */ | ||
|
||
// Cannot be put in the easing.60 test because it is in a different pass | ||
|
||
X := Rectangle { | ||
property <int> g; animate g { easing: cubic-bezier; } | ||
// ^error{must be called} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* LICENSE BEGIN | ||
This file is part of the SixtyFPS Project -- https://sixtyfps.io | ||
Copyright (c) 2020 Olivier Goffart <[email protected]> | ||
Copyright (c) 2020 Simon Hausmann <[email protected]> | ||
|
||
SPDX-License-Identifier: GPL-3.0-only | ||
This file is also available under commercial licensing terms. | ||
Please contact [email protected] for more information. | ||
LICENSE END */ | ||
|
||
|
||
X := Rectangle { | ||
edit := TextInput { } | ||
TouchArea { | ||
clicked => { | ||
(edit.focus)(); | ||
edit.focus; | ||
// ^error{Member function must be called} | ||
} | ||
} | ||
x: edit.focus; | ||
// ^error{Cannot convert function\(element ref\) -> void to length} | ||
// ^^error{Member function must be called} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters