Commit graph

68 commits

Author SHA1 Message Date
Olivier Goffart
8361ef4019 Start code egeneration for the two ways binding
This is only meant to include the cases in which the property are optimized.
Does not work yet for the dynamic component
2020-09-24 14:37:16 +02:00
Olivier Goffart
8134fe5088 Support for named type as property 2020-09-17 13:14:01 +02:00
Olivier Goffart
d924ec6bd9 Fix a bug when using layout within a for loop 2020-09-07 14:03:46 +02:00
Simon Hausmann
2a9c962b8d Exclude exposure of easing and duration typed properties
We decided that their type mapping is not ready for public API yet. For
example for duration we'd like to replace the opaque i64 with another
opaque type that however has convenient conversions to
std::time::Duration or std::chrono::milliseconds. We can't use either
directly because we need ffi compatibility, in order to create an
instance in C++ and pass it to the Rust run-time.

So this hides such properties and instead produces a warning.
2020-09-04 21:25:11 +02:00
Olivier Goffart
59dbb610be Materialize fake properties such as layout width/height 2020-09-01 18:49:49 +02:00
Olivier Goffart
f1ad78bc25 Qt style support for the rust backend
Need to set the SIXTYFPS_STYLE=native env variable while compiling
2020-09-01 12:25:11 +02:00
Olivier Goffart
10e8d7ffb9 Replace the regexp-based lexer with a custom lexer
The regexp crate is huge and takes more than a third of the size of the
wasm-interpreter.
2020-08-28 13:34:43 +02:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Simon Hausmann
5b9c41b76b Add referenced image resources to the dependencies for the rust build 2020-08-07 13:35:44 +02:00
Olivier Goffart
38cd9158ac Report the error while building the Document node
Instead of panicking in later phase.

Use the same function in the syntax_tests that the one we use in the different
compiler frontend so that the problems would also be shown in the tests
2020-08-05 10:54:59 +02:00
Olivier Goffart
52cf481dc4 Fix states in repeated elements
This create reference to new property that needs to be adjusted
2020-08-04 14:02:18 +02:00
Simon Hausmann
30acb11362 Fix handling of properties of nested optimized layout elements
We need to traverse also into the expressions of nested layouts to ensure
any references inside are updated as the
"virtual" properties are moved.
2020-07-29 18:52:22 +02:00
Olivier Goffart
b57f3775c9 Refactor GridLayout 2020-07-28 10:31:05 +02:00
Simon Hausmann
09cae799d3 Fix return type of compile_syntax_node
All call sites are only interested in the root component, so might
as well return that.
2020-07-28 09:21:32 +02:00
Olivier Goffart
def42ba3df Add reserved properties that every item has
These properties are materialized if used
2020-07-27 12:18:55 +02:00
Simon Hausmann
88fb491837 Add support for mapping elements to different native classes
The Rectangle element has properties for a border outline. If those are
used, then the generated code should use BorderRectangle. But if they are
not used, then we can fall back to just generating a Rectangle.
2020-07-24 17:48:19 +02:00
Simon Hausmann
c1c2f63f29 Fix error propagation from imported files
Don't forget to collect the build diagnostics.
2020-07-23 15:32:08 +02:00
Simon Hausmann
2f8e6a8774 Use import statements for what we want to be default widget sets 2020-07-23 15:14:54 +02:00
Simon Hausmann
c38fa4cf90 Add support for import statements when loading types
This is the counter part of the export statement and right now it's
implemented as a dumb recursive file loader. This can be extended in
thefuture to support cycles between files (but not types), if
theresolution of types is done lazily.
2020-07-23 09:44:26 +02:00
Simon Hausmann
bd1c760eca Change object_tree::Document to take a syntax_nodes::Document
We're going to need the Document earlier on anyway for dependency
analysis.
2020-07-23 08:35:35 +02:00
Olivier Goffart
1a1d3dbec0 Store two consecutive read of the same variable in a temporary variable
Avoid to create too many dependencies when not required.
Especially the state transformation can create a lots of read to the same property
2020-07-22 17:24:26 +02:00
Simon Hausmann
a9b0d84a72 Improve source file propagation
Instead of doing the SyntaxNodeWithSourceFile construction as late as
possible (in Document::from_node), we can do it as early as possible.
That'll reduce the chances of missing out the source file and prepares
for dependency loading just based on a SNWS :)

This also makes the source_file optional in the SNWS, but that's
consistent with what the diagnostics expect.
2020-07-22 16:10:02 +02:00
Olivier Goffart
bdea34d8c4 Generate an expression for states 2020-07-21 19:01:48 +02:00
Simon Hausmann
ad12ffaa46 Include all the .60 files in sixtyfps_widgets by default 2020-07-21 17:38:40 +02:00
Simon Hausmann
abe6888296 Collect proper per-file diagnostics in the compiler passes
When creating diagnostics in the passes, report them correctly in the
build diagnostics. There's no automated test yet, but it was manually
verified.
2020-07-21 15:27:41 +02:00
Simon Hausmann
26528a8e9c Keep track of the source file in the syntax tree
When going from the plain rowan::SyntaxNode tree to the syntax_nodes::*
elements, attach the source file and keep track of it from that point
on. That'll pave the way for proper multi-file diagnostics generated
later on from the passes, where we store syntax_nodes::* types.
2020-07-21 15:27:41 +02:00
Simon Hausmann
31223c4b96 Store the path in the diagnostics as Rc
This string (path) will be shared a lot more often in the future.
2020-07-20 15:35:43 +02:00
Simon Hausmann
c8a649c09c Remove unused diagnostics parameter 2020-07-20 08:57:15 +02:00
Simon Hausmann
5cd607fd7e Add support for relative include paths
Resolve them against the main source file directory.
2020-07-17 17:44:32 +02:00
Simon Hausmann
2f0718bffa Add include path options to the viewer and compiler
This allows specifying additional component locations. It works for
simple structs, but not yet for more complex types due to a bug yet to
be fixed :-)
2020-07-17 15:26:35 +02:00
Simon Hausmann
114b51f32b Add include paths to CompilerConfiguration
We'll try to load .60 files from those paths.
2020-07-17 12:15:03 +02:00
Simon Hausmann
ada5f68908 Add aggregating BuildDiagnostics
This type aggregates different per-file diagnostics into a similar interface,
in preparation for reporting diagnostics from multiple source files.
2020-07-17 12:10:25 +02:00
Simon Hausmann
732a56259f Simplify compilation call sites further
Move run_passes into the library compilation function. That way the
FileDiagnostics are created by the parser, can be passed on to the library
compilation function and after that we don't need them anymore and can
replace them with future BuildDiagnostics for example.
2020-07-16 18:53:59 +02:00
Simon Hausmann
4c65760322 Fold FileLoadError into the diagnostics module
The FileDiagnostics now hold a vector of Diagnostic elements, which is an
enum of either a CompilerDiagnostic or a FileLoadError.
2020-07-16 18:28:27 +02:00
Simon Hausmann
e914715d88 Rename Diagnostics to FileDiagnostics
As this structure holds the diagnostics just for one file.
2020-07-16 18:25:42 +02:00
Simon Hausmann
c85f2537d3 Fix signature of function to load types from a directory
Taking &mut self makes more sense when wanting to populate from a list.

Also we should return a list of diagnostics for each file that we loaded
or an error if we couldn't load the file (for example due to permission
problems, etc.).

This way the caller can choose to show diagnostics, ignore them, etc.
2020-07-16 13:45:45 +02:00
Simon Hausmann
c3aae7648a Further simplify compilation call sites
Remove the need to construct the type registry at all the call sites by
offering a compile_syntax_node function in the compiler library.
2020-07-16 09:25:26 +02:00
Simon Hausmann
2ac0805409 Minor cleanup
Don't need an accessor function in the Document for a public field. That said,
the choice of registry instance for the path "compilation" doesn't really matter,
as the lookup shall always end up
in the global registry.
2020-07-15 13:36:30 +02:00
Simon Hausmann
5b43962bb2 Split up TypeRegistry
For a .60 files the locally defined components are now stored in a separate
per-document TypeRegistry instance that falls back to the global registry
for lookups.
2020-07-15 13:09:43 +02:00
Simon Hausmann
719bff4eca Minor cleanup
Don't require a mutable type registry for the compiler passes.
2020-07-15 11:25:28 +02:00
Simon Hausmann
f6761e2c4c Allow for the positioning of PathLayouts via x/y properties
These are just "virtual" properties that will be transformed into
property members of the main struct through the optimized elements
sub-pass.
2020-07-13 13:34:04 +02:00
Simon Hausmann
a679f33871 Process path elements in PathLayout
Collect them and assign them to an "elements" property, like with Path {}.

Also process paths before layouts.
2020-07-09 14:18:27 +02:00
Simon Hausmann
251ef7fc97 Add support for SVG commands in Path elements
Using the commands property we can just paste SVG paths. This makes it
much easier to write examples/demos. A good online path designer is
for example https://codepen.io/anthonydugois/pen/mewdyZ
2020-07-09 13:41:57 +02:00
Simon Hausmann
a83127ace8 Prepare the path element compilation for extensibility
Avoid any element specific code in the Rust and C++ generator and
minimize the involvement in the interpreter.
2020-07-07 14:14:17 +02:00
Simon Hausmann
a71c67152e Revert "Prepare for additional path elements"
This reverts commit d143addb07.

We're going to need to support binding expressions in path elements.
2020-07-07 14:14:17 +02:00
Simon Hausmann
facc18d0eb Fix formatting
RA stopped working for some odd reason :-/
2020-07-02 11:25:29 +02:00
Simon Hausmann
d143addb07 Prepare for additional path elements
Require that the values to the path element properties are numerical literals.
The conversion happens in the path "compilation" pass, where we can do more
pre-calcuation in the future.
2020-07-02 10:40:31 +02:00
Simon Hausmann
5e61ed4ad2 Implement Path and LineTo in the markup 2020-07-01 15:13:23 +02:00
Olivier Goffart
6122f91fba Begin with the generation of rhe repeater (rust only for now) 2020-06-16 13:47:02 +02:00