Commit graph

4925 commits

Author SHA1 Message Date
Simon Hausmann
2c1e6bcb20 Add boilerplate for gallery rust build 2020-07-24 07:52:08 +02:00
Olivier Goffart
debd2b5839 Smaller workaround for the fact that some function are not exported 2020-07-23 17:11:00 +02:00
Simon Hausmann
f1d9f4a04e Start with a gallery boilerplate 2020-07-23 15:48:29 +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
6ca062181e Rework the file import logic
This is more readable (one can argue) and the file system operations are
to just open, instead of stat and open.
2020-07-23 15:14:54 +02:00
Olivier Goffart
8af7d27cf9 Extand the animation test to check that animation start even if the property is not being queried 2020-07-23 14:51:28 +02:00
Olivier Goffart
1d7effd030 Add missing files 2020-07-23 11:56:43 +02:00
Olivier Goffart
05c5f7c53d Test and fix animations on properties
The animation should not start when the property is initialized, only when the
property is set by the setter
2020-07-23 11:45:34 +02:00
Simon Hausmann
84406cc70b Add support for renaming imports
This is very useful to avoid name clashes.
2020-07-23 10:12:45 +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
Olivier Goffart
bfab84288e Property: add a function to get the property without registering a dependency 2020-07-22 17:23:32 +02:00
Olivier Goffart
3f3c47f0ed Property<T>: Add a Binding trait which would allow binding to access the old value 2020-07-22 17:23:32 +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
Simon Hausmann
7b7f38ae65 Clean up compiler tests directory a little
I added files unrelated to the syntax tests in the tests/ folder, but
that won't scale. Those files aren't meant to be subject to the syntax
test and there are more files to come in the future. So this change
moves the syntax test related cases into a dedicated sub-folder, as well
as the type loader/registry related ones.
2020-07-22 14:36:01 +02:00
Simon Hausmann
0b5f4054ea Improve import uri parsing
Avoid unnecessary SyntaxKind variants. The import uri is simply the first string literal in the ImportSpecifier.

Also covert the case of an empty import list and use expect() instead of
test() to produce a meaningful error message.
2020-07-22 14:06:42 +02:00
Simon Hausmann
3e619170cd Extend the parser with support for import statements 2020-07-22 11:31:58 +02:00
Olivier Goffart
fd1760e931 Document states and transitions 2020-07-22 09:51:13 +02:00
Simon Hausmann
dfca0d62b5 Improve setup experience with VS code
When starting in a new work space, offer a bunch of recommended extensions.
2020-07-22 09:38:02 +02:00
Simon Hausmann
3e21aafab9 Add support for direct export for convenience 2020-07-22 08:45:49 +02:00
Simon Hausmann
921a41b07c Add support for explicit exports from files
Using an ES module inspired syntax, this allows free naming and control
over exported names.
2020-07-22 08:40:30 +02:00
Olivier Goffart
a5985a3162 fix last commit 2020-07-21 19:10:19 +02:00
Olivier Goffart
bdea34d8c4 Generate an expression for states 2020-07-21 19:01:48 +02:00
Olivier Goffart
66cb6ca173 Fix spelling in filename 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
01fa05eeff Generalize maybe_convert_to
We don't need a concrete node, just the spanned trait impl. This simplifies the call
sites a little and reduces the noise in the upcoming patches.
2020-07-21 15:27:41 +02:00
Simon Hausmann
a5eb763c54 Eliminate another span() call site 2020-07-21 15:27:41 +02:00
Olivier Goffart
e486505bb6 Fix the rustwasm build
Somehow in this case, the repeated element stayed borrowed
2020-07-21 13:44:52 +02:00
Olivier Goffart
46ca98b159 Make sure to visit all the expressions in the different passes
Including the new expressions in the states
2020-07-21 13:30:04 +02:00
Olivier Goffart
d27bd60e45 Fix tests 2020-07-21 12:15:48 +02:00
Olivier Goffart
9d735d98cd Build the transitions tree and more flexible animations 2020-07-20 18:46:04 +02:00
Olivier Goffart
9972739fc2 Use ByAddress for the inlining mapping 2020-07-20 17:01:24 +02:00
Simon Hausmann
2055a2fbd7 Eliminate a few more span call sites
SyntaxToken supports Spanned and this appears to be equivalent to the manual span creation.
2020-07-20 16:12:40 +02:00
Simon Hausmann
f8c0eb0bd6 Prepare for passing passing more information from syntax node to diagnostics
Let the bulk of the push_error() calls take a Spanned trait impl, so
that we can pass node on the call sites. Then when later change the
underyling trait to pass something that can also provide the source file
and we don't have to change all call sites again.
2020-07-20 16:01:15 +02:00
Simon Hausmann
0cb59381e4 Fix type of PropertyDeclaration::type_location
In preparation for passing through the source file, avoid storing the Span
in the object tree and instead store the syntax node.
2020-07-20 15:36:17 +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
Olivier Goffart
c0fab1c3e9 More progress in states and transition parsing
Fill the object_tree with states, and part of the transition

Also make sure to duplicate animations properly in inlining
2020-07-20 15:04:06 +02:00
Olivier Goffart
0dff3f5f78 Parse state and transition 2020-07-20 12:59:12 +02:00
Simon Hausmann
4ba2425011 Use a HashSet instead of a HashMap
As pointed out by Olivier, it's possible to get the pointer back by
using ByAddress' Deref implementation.
2020-07-20 11:29:53 +02:00
Simon Hausmann
f2d6d65cd8 Fix a bug with external types using expressions
Types from external files need to be included in the inlining.
2020-07-20 10:48:53 +02:00
Simon Hausmann
c8a649c09c Remove unused diagnostics parameter 2020-07-20 08:57:15 +02:00
Simon Hausmann
da85889c74 Make sure to re-run tests if an external include path changed 2020-07-19 18:36:36 +02:00
Simon Hausmann
cb081a6bda Test that loading types from the include path works
This uses the recently added "hooks" or APIs to pass an include path that's specified in the test case itself.
2020-07-19 18:31:10 +02:00
Simon Hausmann
0aaa163058 Add support for specifying include paths to the nodejs API
I tried passing this as a component of the file name (uri style with a query),
but nodejs wants only valid paths for
require() calls. So instead this uses simply an environment variable.
2020-07-19 18:29:37 +02:00
Simon Hausmann
a178b9b2e3 Add support for include paths to the procedural macro
Using a #[include_path="../path"] attribute. Not quite perfect, but it works :-)
2020-07-17 17:44:32 +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