slint/internal/compiler
Simon Hausmann fef9c446a4
Fix missing invocation of init callbacks due to inlining (#4322)
When a component declares an init callback as well as the element that
instantiates it, the init callback of the container would not
get invoked if the container was inlined:

```
component InlinedContainer {
    init => { ... } // not invoked
    @children // force inlining
}

component UseSite {
    InlinedContainer {
        init => { ... }
    }
}
```

That's because the inlining happens very early, before the init
callbacks are collected into the init code. And during inlining that
would be treated like a property binding and the "binding" at the
element site overrides the one at the component site.

One natural approach would be to move the init code collection to an
earlier place before inlining, but that isn't possible because the
boundaries of the compiler components (Rc<Component>) aren't set
up yet (repeated component extraction phase happens much later).

An alternative would be to re-introduce the init callback code in
ElementRc and place it in there at *::from_node() time.

This patch chooses to solve this at the inlining time: When we're in the
first phase of the inlining (the optional one), do what
with the init binding what collect_init_code would do later: Move it
straight into the init_code of the component we're inlining into.

Fixes #4317
2024-01-12 10:14:27 +01:00
..
generator Add set-selection-offsets function to TextInput, TextEdit, and LineEdit (#4197) 2024-01-06 11:12:53 +01:00
LICENSES Update license symlinks 2023-08-16 11:46:15 +02:00
llr Add set-selection-offsets function to TextInput, TextEdit, and LineEdit (#4197) 2024-01-06 11:12:53 +01:00
parser Parser: Hint for the mod function when parsing % 2023-12-19 17:23:30 +01:00
parser-test-macro Janitor: Use cargo workspace package data more 2023-09-25 16:34:16 +02:00
passes Fix missing invocation of init callbacks due to inlining (#4322) 2024-01-12 10:14:27 +01:00
tests Test purity of model expression 2024-01-11 15:13:01 +01:00
widgets Add set-selection-offsets function to TextInput, TextEdit, and LineEdit (#4197) 2024-01-06 11:12:53 +01:00
build.rs Janitor: Optimize usage of is_dir/is_file 2023-12-27 10:36:25 +01:00
builtin_macros.rs Add clamp function to slint language 2023-11-22 12:27:54 +01:00
builtins.slint Add set-selection-offsets function to TextInput, TextEdit, and LineEdit (#4197) 2024-01-06 11:12:53 +01:00
Cargo.toml Upgrade to fontdue 0.8 2023-11-29 10:52:27 +01:00
diagnostics.rs lsp: Handle selections and highlighting in the LSP 2023-12-20 19:28:35 +01:00
embedded_resources.rs Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
expression_tree.rs Add set-selection-offsets function to TextInput, TextEdit, and LineEdit (#4197) 2024-01-06 11:12:53 +01:00
fileaccess.rs i-slint-compiler: Add some tests for fileaccess 2023-10-25 14:25:53 +02:00
generator.rs Debug: use pretty-print to dump the LLR 2023-08-22 16:20:13 +02:00
langtype.rs janitor: Go over our spell checking setup 2023-10-16 09:01:51 +02:00
layout.rs compiler: pre-inline layout info for known builtin types 2023-10-12 12:55:00 +02:00
lexer.rs Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
lib.rs Allow specifying paths for @library imports 2023-10-20 16:47:00 +02:00
literals.rs Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
llr.rs janitor: Go over our spell checking setup 2023-10-16 09:01:51 +02:00
load_builtins.rs compiler: Store an optional version number with the document 2023-12-18 14:21:50 +01:00
lookup.rs Compiler: Error when assigning to compile time properties 2023-12-12 21:51:56 +01:00
namedreference.rs Fix property wrongly considered as const if it is modified through an alias 2024-01-02 17:36:22 +01:00
object_tree.rs interpreter: Add highlighting feature-gated functions 2023-12-20 19:28:35 +01:00
parser.rs compiler: Store an optional version number with the document 2023-12-18 14:21:50 +01:00
passes.rs Layout: when using a fixed window size, dissociate the WiondowItem's size with the slint size 2023-10-27 17:45:46 +02:00
pathutils.rs janitor: Fix a semi-random selection of clippy warnings 2023-10-16 13:44:37 +02:00
README.md reuse: remove glob for markdown files 2023-08-17 08:55:28 +02:00
typeloader.rs compiler: Store an optional version number with the document 2023-12-18 14:21:50 +01:00
typeregister.rs Add set-selection-offsets function to TextInput, TextEdit, and LineEdit (#4197) 2024-01-06 11:12:53 +01:00

The Slint Compiler Library

NOTE: This library is an internal crate of the Slint project. This crate should not be used directly by applications using Slint. You should use the slint crate instead.

WARNING: This crate does not follow the semver convention for versioning and can only be used with version = "=x.y.z" in Cargo.toml.