mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 02:39:28 +00:00
parent
4718d5b050
commit
f0e02a3aa3
2 changed files with 36 additions and 19 deletions
|
@ -70,28 +70,31 @@ fn ensure_pure(
|
|||
}
|
||||
None => {
|
||||
if recursion_test.insert(nr.clone()) {
|
||||
if !ensure_pure(
|
||||
&nr.element()
|
||||
.borrow()
|
||||
.bindings
|
||||
.get(nr.name())
|
||||
.expect("private function must be local and defined")
|
||||
.borrow()
|
||||
.expression,
|
||||
None,
|
||||
level,
|
||||
recursion_test,
|
||||
) {
|
||||
if let Some(diag) = diag.as_deref_mut() {
|
||||
diag.push_diagnostic(
|
||||
format!("Call of impure function '{}'", nr.name()),
|
||||
node,
|
||||
level,
|
||||
match nr.element().borrow().bindings.get(nr.name()) {
|
||||
None => {
|
||||
debug_assert!(
|
||||
diag.as_ref().map_or(true, |d| d.has_errors()),
|
||||
"private functions must be local and defined"
|
||||
);
|
||||
}
|
||||
r = false;
|
||||
Some(binding) => {
|
||||
if !ensure_pure(
|
||||
&binding.borrow().expression,
|
||||
None,
|
||||
level,
|
||||
recursion_test,
|
||||
) {
|
||||
if let Some(diag) = diag.as_deref_mut() {
|
||||
diag.push_diagnostic(
|
||||
format!("Call of impure function '{}'", nr.name()),
|
||||
node,
|
||||
level,
|
||||
);
|
||||
}
|
||||
r = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
recursion_test.remove(nr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
14
internal/compiler/tests/syntax/fuzzing/6518.slint
Normal file
14
internal/compiler/tests/syntax/fuzzing/6518.slint
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
||||
|
||||
Compo1:=R{property<int b;function bb)i{}}c:=Compo1{b:self.bb
|
||||
// ^error{Syntax error: expected '>'}
|
||||
// ^^error{Syntax error: expected '\('}
|
||||
// ^^^error{Syntax error: expected '\{'}
|
||||
// ^^^^error{invalid expression}
|
||||
// ^^^^^error{Syntax error: expected '\}'}
|
||||
// ^^^^^^error{Parse error}
|
||||
|
||||
}
|
||||
// ^error{Syntax error: expected ';'}
|
||||
/**/
|
Loading…
Add table
Add a link
Reference in a new issue