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
Olivier Goffart
e7d2c35a07
Use triomphe instead of servo_arc
...
That's a fork of servo_arc which is updated more recently
2020-07-17 17:13:51 +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
Olivier Goffart
27c3b2ab5a
Fix crash in C++ due to uninitialized CachedRenderingData
2020-07-17 15:00:12 +02:00
Olivier Goffart
0feec40a31
Add a quick and dirty code indenter so the generated code has several lines
...
This helps to debug error messages
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
5dc53f0f79
Remove unused diagnostics argument in the interpreter
2020-07-17 11:52:29 +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
4721dbfd53
Fix build with clang
...
Include cmath to get the overload of std::abs that takes a float.
2020-07-16 13:58:18 +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
298c8586d2
Fix window property propagation for the nodejs front-end
2020-07-16 08:20:20 +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
Olivier Goffart
20e7f3178e
Rust: add a dpi variable in the component which is used when converting px to lx
2020-07-15 16:39:43 +02:00
Simon Hausmann
46bae52c15
Add support for loading types from a directory containing .60 files
2020-07-15 14:39:45 +02:00
Simon Hausmann
107aa63a7c
Add the ability to extend a type registry with a .60 file
2020-07-15 14:30:02 +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