slint/internal/compiler
Olivier Goffart 6f61a45bec compiler: Simplify struct access expression of constants after struct-cast
We see that a lot in the fluent style. For example:
```
   font-size: Typography.body.font-size;
```

Where Typography.body is a contant expression define as
```
    out property <TextStyle> body: {
        font-size: 14 * 0.0769rem,
        font-weight: regular-font-weight
    };
```

But because this first converts from an annonymous tuple struct to a
named struct, the const propagation used to be confused. Now with this
patch it is properly simplified

Before this change

cargo run -p slint-compiler -- examples/printerdemo_mcu/ui/printerdemo.slint -f rust | rustfmt | wc
  38643   84506 1925846
cargo run -p slint-compiler -- examples/gallery/gallery.slint -f rust | rustfmt | wc
 103210  224427 5291034

After this change

cargo run -p slint-compiler -- examples/printerdemo_mcu/ui/printerdemo.slint -f rust | rustfmt | wc
  38629   84473 1924995
cargo run -p slint-compiler -- examples/gallery/gallery.slint -f rust | rustfmt | wc
  102628  222423 5261760
2023-10-12 14:21:08 +02:00
..
generator Prospective fix for MSVC warnings 2023-10-09 17:25:24 +02:00
LICENSES Update license symlinks 2023-08-16 11:46:15 +02:00
llr Compiler: be more granular for checking for explicit layout constraint 2023-10-12 12:55:00 +02:00
parser Add support for protected functions 2023-10-11 10:50:50 +02:00
parser-test-macro Janitor: Use cargo workspace package data more 2023-09-25 16:34:16 +02:00
passes compiler: Simplify struct access expression of constants after struct-cast 2023-10-12 14:21:08 +02:00
tests Add support for protected functions 2023-10-11 10:50:50 +02:00
widgets Introduce ComboboxBase and in/decrement selection by scroll event (#3648) 2023-10-11 12:55:49 +02:00
build.rs Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
builtin_macros.rs Add component-factory type to Slint language 2023-07-27 12:04:16 +02:00
builtins.slint Implement TouchArea::scroll-event 2023-10-07 07:59:53 +02:00
Cargo.toml napi test driver setup (#3635) 2023-10-11 12:48:27 +02:00
diagnostics.rs Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
embedded_resources.rs Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
expression_tree.rs Compiler: fix conversion from unnamed to named struct 2023-09-07 14:57:05 +02:00
fileaccess.rs compiler: Rework path handling 2023-10-10 20:04:47 +02:00
generator.rs Debug: use pretty-print to dump the LLR 2023-08-22 16:20:13 +02:00
langtype.rs Add support for protected functions 2023-10-11 10:50:50 +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 compiler: Rework path handling 2023-10-10 20:04:47 +02:00
literals.rs Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
llr.rs Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
load_builtins.rs Refactoring: define macro rules to group builtin structs 2023-08-03 11:01:18 +02:00
lookup.rs linuxkms: Implement keyboard input and clamp mouse 2023-07-31 17:27:53 +02:00
namedreference.rs Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
object_tree.rs Add support for protected functions 2023-10-11 10:50:50 +02:00
parser.rs compiler: Rework path handling 2023-10-10 20:04:47 +02:00
passes.rs Adapt the highlight to the new geometry 2023-09-13 16:08:37 +02:00
pathutils.rs compiler: Rework path handling 2023-10-10 20:04:47 +02:00
README.md reuse: remove glob for markdown files 2023-08-17 08:55:28 +02:00
typeloader.rs compiler: Rework path handling 2023-10-10 20:04:47 +02:00
typeregister.rs Add support for protected functions 2023-10-11 10:50:50 +02: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.