Commit graph

305 commits

Author SHA1 Message Date
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
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
Olivier Goffart
6c54dfb67d Layout the item in a PathLayout if they are part of a repeater 2020-07-17 15:00:12 +02:00
Simon Hausmann
e40aec1b4e Silence warning about dead code 2020-07-17 14:51:19 +02:00
Simon Hausmann
a356dc2725 Fix build without display-diagnostics 2020-07-17 14:42:17 +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
893b5132c8 Further encapsulate Diagnostics
Use has_error() and a new convenience function to get the diagnostics as a string vector.
2020-07-17 11:52:29 +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
4d12bbb954 Fix type dependency test
Test loading the type that depends on another on our test registry, not the builtin one.
2020-07-16 18:50:54 +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
4c1e4c4da4 Reduce direct access to CompilerDiagnostic::message
Instead use to_string(), to make it easier to change in the future.
2020-07-16 18:22:23 +02:00
Simon Hausmann
23ee925947 Diagnostics refactoring, part 2
Remove the need for PartialEq for the Diagnostics. The objective is to
introduce an enum here in the future
that may hold types that do not support
PartialEq. It turns out that we don't really need it though.
2020-07-16 17:49:29 +02:00
Simon Hausmann
a68cf95d98 Diagnostics refactoring
Remove the need to clone compiler diagnostics. We can avoid it here it
seems.
2020-07-16 17:44:52 +02:00
Olivier Goffart
5e7d5369aa Few fixes to the layout and add a test that the items are well positioned 2020-07-16 17:22:29 +02:00
Olivier Goffart
96cfd8a620 Fix property named "value" in C++, and fix comparison of lenght in rust 2020-07-16 17:22:29 +02:00
Simon Hausmann
08f9e6089e Fix loading of dependent types
Provided the caller gets the order of calls to add_type_from_resource, it
should be possible to load one type after another that depends on the former.
2020-07-16 15:01:04 +02:00
Simon Hausmann
3611d274eb Prepare type registry hierarchy for run-time extension
It should be possible to load multiple times into the same registry,
which will require interior mutability: While a loaded type has a
reference to the registry, a newly loaded type shall be added.
2020-07-16 14:59:09 +02:00
Simon Hausmann
d35c68254d Added a test case for type dependencies 2020-07-16 14:18:49 +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
Olivier Goffart
170564ecea Implement % as a unit 2020-07-16 11:24:46 +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
64a4e749b7 Simplify path setup in the Diagnostics
Pass the path to the parse function, as that's easier at most call sites.
Also offer a convenience parse_file function.
2020-07-15 19:21:25 +02:00
Olivier Goffart
0fbf38f642 Let the compilerlib compile without the codemap dependencies
The idea is that we wouldn't need to bring this dependencies
if the interpreter is running on wasm for example
2020-07-15 19:08:00 +02:00
Olivier Goffart
dfd4a35e35 Set the DPI property according to the window's screen 2020-07-15 18:46:55 +02:00
Olivier Goffart
1dec276002 Continue adapting the window size
Implement the Rust and C++ part
2020-07-15 17:52:14 +02:00
Simon Hausmann
ddc4fb6e1f WIP: window size
Just playing around with propagating the width/height of the window.
2020-07-15 17:52:14 +02:00
Simon Hausmann
055517dc2c Remove duplicated code in Diagnostics emission 2020-07-15 17:34:11 +02:00
Simon Hausmann
8e047d3761 Simplify compiler diagnostics API
Don't require the callers to hold on to the source code string until an
eventual diagnostics code path is hit. Instead it turns out it's
simpler to let the parser consume the source code as string, where
internally after tokenizing it can be moved into the diagnostics and
from there into the code map if needed.

There are a few places where we now clone the source code, but that's
only in cases where we also extract stuff separately (test code) or the
syntax updater.
2020-07-15 17:34:11 +02:00
Olivier Goffart
96e5738785 Add a DPI variable in the interpreter and in the C++ backend 2020-07-15 17:13:23 +02:00