DDavid FaureFinal set of clippy fixes in internal/compiler
| Files | Last commit | Last update |
|---|---|---|
Simplify commercial license (#3063) Base the commercial license on the Royalty-free license adding clauses pertaining to the fees. | 2 years ago | |
Final set of clippy fixes in internal/compiler | 8 months ago | |
refactor: Generate typing.Tuple for Color, LogicalPosition, and LogicalSize built-in structs in Python type name generation. | 8 months ago | |
Final set of clippy fixes in internal/compiler | 8 months ago | |
compiler: move interface related code to an object_tree::interfaces module I need to extract some more helper functions, and the interface related code is already getting relatively large. Move it to it's own module to keep object_tree.rs a reasonable size. | 8 months ago | |
Remove license header from .md/.mdx files They should be in the lines, but the problem is that this causes issues in the .mdx files. License header doesn't really make sense for .md files anyway | 11 months ago | |
@keys: Use ? instead of Ignore* This is the preferred syntax as discussed in #102 | 8 months ago | |
Fix clippy warnings in internal/compiler/passes | 8 months ago | |
@keys: Use ? instead of Ignore* This is the preferred syntax as discussed in #102 | 8 months ago | |
ComboBox: Clamp index on reset instead of using 0 Setting both the model and the current index in the ComboBox was causing a race condition where the changed handler was potentially overriding a current value change. We can hide this race condition, by not entirely resetting the model index, but just clamping it. That makes model resets more graceful in general, if the data in the model remains similar. Closes #10805 | 8 months ago | |
software renderer & compiler: Replace fontdue with swash (#10825) Use swash to pre-compile glyphs in the compiler as well as rendering them at run-time with the systemfonts feature. This eliminates a dependency (fontdue, swash already exists via femtovg) and speeds up the screenshot drivers test. | 9 months ago | |
Remove license header from .md/.mdx files They should be in the lines, but the problem is that this causes issues in the .mdx files. License header doesn't really make sense for .md files anyway | 11 months ago | |
Ensure error reporting when using buffered file writes Quoting from the BufWriter docs: >It is critical to call flush before BufWriter<W> is dropped. Though >dropping will attempt to flush the contents of the buffer, any errors >that happen in the process of dropping will be ignored. Calling flush >ensures that the buffer is empty and thus dropping will not even >attempt file operations. | 1 year ago | |
Add platform-native string conversion for keyboard shortcuts | 9 months ago | |
Shortcut: Add enabled property During discussion in issue #102 it was agreed that this property should exist as an alternative to putting the shortcut in an if statement. | 8 months ago | |
Shortcut element (#10798) * Add a Shortcut element This element can be placed inside a FocusScope and provides an activated callback when the shortcut is activated. * Add C++ test for Shortcut element * Add Shortcut documentation * [autofix.ci] apply automated fixes * FocusScope: Activate one shortcut at maximum * Compiler: Duplicate shortcuts warning * Incoporate feedback by @tronical * Add note-level diagnostics --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> | 9 months ago | |
Signed DistanceField font rendering in swrenderer Note that this is still disabled in the compiler with no way to enable it with public API | 2 years ago | |
GridLayout: switch to a new cache format, to later allow nested repeaters (#10866) Use a single jump cell for repeaters in grid layouts (rather than one per child of a repeated row). From there we jump to an area that has entries for all the children in that row. This will allow to make that area of a dynamic size in a later commit, to support nested repeaters. This commit already has some bits that will be useful later, like the fact that inner_rep_idx is an Expression even if right now it's always set to a literal value. Same for stride_h_expr and friends. Overall this is a no-op feature wise, just a different cache format. | 8 months ago | |
Port from vec![] to Vec::new() vec![] expands to Vec::new(), but expanding macros takes a bit of time and takes memory in rust-analyzer. Also, the code was using a mix of vec![] and Vec::new(), so this is more consistent. | 11 months ago | |
Add interfaces as a proof-of-concept experimental feature (#10181) * compiler: Introduce ElementType::Interface Add a new ElementType variant that will allow us to parse interface declarations using the existing element parsing code. The match arms implemented are my best guess based on the context of the enclosing function and how a global is handled. * compiler: interface is a valid top-level item keyword A document may contain zero or more interfaces. Interfaces do not support inheritance. * compiler: An interface excludes the same content as a global Verify that an interface cannot have: - sub elements; - repeated elements; - property animations; - states; - transitions; - an init callback declaration; - an init callback implementation. * compiler: An interface can have public properties Warn if private properties are declared. * compiler: implements is a valid keyword It is treated as an alias for inherits, for now. * compiler: Cannot "implement" non-interface components The compiler produces an error when the implements keyword is used before a global, component, or builtin type. The parser doesn't know about this kind of relationship - the "implements" and "inherits" keywords are just consumed. For now we just go back and check what the expected relationship type was whilst constructing an Element. * compiler: interface properties are exposed Attempt to verify that the interpreter can see and use properties declared in an interface that a component implements. This is an initial proof-of-concept, we will need to come back and add checks and tests for mixing 'inherits' with 'implements'. * Move existing interface syntax texts to syntax/interfaces Group interface related tests in a subdirectory of their own. * compiler: Add uses specified as valid new component syntax Allow a new component to specify that it exposes one or more interfaces via a given child element. This commit introduces the syntax, we will add the implementation in a future commit. * compiler: uses statements expose interface properties from child For each uses statement, iterate through the interface properties and create two-way bindings to the property on the specified base component. The error cases will be populated in follow-up commit. For now, demonstrate that the initial concept works. * compiler: emit errors for invalid interfaces in uses statements Detect and emit errors where: - the type specified in a uses statement is not an interface; - the type specified in a uses statement is unknown; - the type specified in a uses statement cannot be used in this context. * compiler: emit an error when the child specified in a uses statement does not exist Add a test case to verify the expected error message. * compiler: verify that external interfaces can be implemented Add a test to verify that interfaces from imported modules can be used. * compiler: verify that renamed components and interfaces can be used Add a test case to verify that: - we can import an interface as another name and re-use it; - we can import a component that implements a renamed interface and use it. * compiler: verify that the child component implements the interface For each property in an interface that a child element is expected to implement, verify that the child has a property with the same name, type and visibility. This is easier than attempting to store and match interface names which may change if the user renames an interface when importing. * compiler: do not allow interface properties to be overridden Emit a compile error if the user attempts to declare a property that would override a property from an interface. * compiler: do not permit interfaces to be used if they would override an inherited property Look up the interface property on the base type before allowing a component to implement the interface. * compiler: emit an error if a uses statement attempts to override an existing binding I couldn't figure out a good way to test this - everything I came up with got caught by the prior check that the property does not already exist. * compiler: 'interface', 'implements' and 'uses' are experimental features Guard these keywords behind the experimental features flag. Slint must be compiled with the SLINT_ENABLE_EXPERIMENTAL_FEATURES environment variable set to enable these keywords. * compiler: parse_uses_identifier returns a valid SyntaxKind::UsesIdentifier Previously we were not creating a DeclaredIdentifier if a syntax error was encountered. This would cause a panic when UsesIdentifier::DeclaredIdentifier() was called for a node with a syntax error. As a result, we can convert TryFrom<&syntax_nodes::UsesIdentifier> for UsesStatement to From<&syntax_nodes::UsesIdentifier> for UsesStatement. * compiler: simplify UsesSpecifier -> UsesSpecifierList -> UsesIdentifier to UsesSpecifier -> UsesIdentifier We don't need to intermediate list object because we only expect a UsesSpecifier to contain UsesIdentifiers. * lsp: Ensure that uses statements are not broken Previously the space between the DeclaredIdentifier and the from keyword was being removed. E.g.: slint component C uses { Foo from bar } { } would become: slint component C uses { Foofrom bar } { } This would cause a syntax error. This no longer happens. * compiler: ':=' to declare an interface is an error Previously this was a warning to match the global behaviour. Given that interfaces are a new feature, make it an error to declare them using the deprecated ':='. * compiler: private properties in an interface are an error It does not make sense to declare an interface with properties that are not accessible to the user of the interface. * Update insterface syntax tests The syntax for declaring an expected diagnostic has changed to include the span (#9703). Update the interface tests that were added using the old syntax. * compiler: check experimental features before emitting more specific interface errors The implements keyword should not be supported if experimental features are not enabled. * compiler: Simplify UsesStatement Only store the syntax_nodes::UsesIdentifier and replace the old members with functions returning the appropriate child node of the UsesIdentifier. * compiler: clean up ElementType::Interface TODO comment We cannot instantiate an interface element, so we should not be able to reach one by recursing into the children of a component. | 11 months ago | |
@keys: Use ? instead of Ignore* This is the preferred syntax as discussed in #102 | 8 months ago | |
FlexBoxLayout: implement "align-items" property Add FlexAlignItems enum with Stretch (default), Start, End, Center. This controls the alignment of individual items along the cross axis within each flex line, matching CSS flexbox "align-items". The default changes from FlexStart (previously hardcoded) to Stretch (the CSS default). Items without an explicit cross-axis size now stretch to fill the flex line, while items with explicit sizes are unaffected. | 9 months ago | |
Lexer: Emit individual lex error tokens (#10497) * Lexer: Emit individual lex error tokens Previously, we would abort the entire lexer. Now simply return error tokens until the lexer has recovered. This can sometimes prevent confusing parser errors, where e.g. a missing closing bracket is reported that actually exists after the lex error. * Don't use str::ceil_char_boundary due to MSRV Use char::len_utf8 instead. * [autofix.ci] apply automated fixes * Update internal lexer tests --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> | 10 months ago | |
Final set of clippy fixes in internal/compiler | 8 months ago | |
Janitor: Use "!is_empty" vs "len() > 0" (#10455) | 10 months ago | |
Extract lower_layout_expression.rs from lower_expression.rs | 9 months ago | |
Port from vec![] to Vec::new() vec![] expands to Vec::new(), but expanding macros takes a bit of time and takes memory in rust-analyzer. Also, the code was using a mix of vec![] and Vec::new(), so this is more consistent. | 11 months ago | |
Final set of clippy fixes in internal/compiler | 8 months ago | |
compiler: improve 3 internal error messages, to help debugging | 10 months ago | |
Expose layout kind through the test protocol Encode the layout kind (h-box, v-box, grid, flex-box) as a third field in the debug info string emitted by the compiler, and surface it through ItemRc, ElementHandle, and the systest protobuf protocol. This allows test tooling to distinguish layout elements from plain rectangles. | 8 months ago | |
compiler: Have a keyboard-shortcut type This is represented as a KeyboardShortcut struct at the moment. | 9 months ago | |
Shortcut element (#10798) * Add a Shortcut element This element can be placed inside a FocusScope and provides an activated callback when the shortcut is activated. * Add C++ test for Shortcut element * Add Shortcut documentation * [autofix.ci] apply automated fixes * FocusScope: Activate one shortcut at maximum * Compiler: Duplicate shortcuts warning * Incoporate feedback by @tronical * Add note-level diagnostics --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> | 9 months ago | |
[clippy] remove enclosure. Use directly function as we don't modify variable (#10463) | 10 months ago | |
Final set of clippy fixes in internal/compiler | 8 months ago | |
Final set of clippy fixes in internal/compiler | 8 months ago | |
Final set of clippy fixes in internal/compiler | 8 months ago |
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.