Commit graph

178 commits

Author SHA1 Message Date
Simon Hausmann
fa1ac9884d Verify the existence of imported custom fonts
... and produce diagnostics.

That way in later phases we don't need to check again.

As an unfortunately side-effect, we need to skip one of the examples in
the language reference from the doc test, as the compilation fails
because the font does not exist.
2022-01-19 16:24:22 +01:00
Olivier Goffart
a8bc254dd3 Fixes loop detection involving sub components and two ways binding
The original binding analysis code was considering that all the sub components
were inlined. But when this is not the case, we need to re-analyze each
sub component within their parent.

We also need to take care of reverse aliases

Will cause a .60 compile time binding loop error instead of a
runtime recursion panic in code like issue #772
2022-01-17 19:48:37 +01:00
Olivier Goffart
a2e74f9df2 Test and fixe error involving invalid array access 2022-01-14 13:38:25 +01:00
Olivier Goffart
ad13f2696d remove_alias: also go through the aliases in globals
This should make sure that we don't have leftover aliases in global
2022-01-12 16:22:35 +01:00
Olivier Goffart
53c3e6a279 WIP: introduce the new llr module (Low Level Representation)
The main thing here is that the Component are in different data structure
depending on whether they are sub-component global component or repeated component

Then the properties at are the right place and there will be no more lookup
in the base. The PropertyReference knows how to access which property via which
element and such.

The idea is that it will be easier to lower from this representation than
what we currently do in each language backend.

This commit is still WIP, it is far from finished
2022-01-12 16:22:35 +01:00
Simon Hausmann
89df782463 Don't panic in the compiler when encountering a Path element with for-in
Instead, produce a diagnostic message.

cc #754
2022-01-06 12:53:46 +01:00
Tobias Hunger
bfca0e3573 Mass update copyright messages to be more REUSE compliant 2021-12-22 10:06:12 +01:00
Olivier Goffart
b8cc59afca Fix panic when compiling a property that references itself
Fixes #737
2021-12-13 15:00:19 +01:00
Olivier Goffart
0436ce2399 Allow to access color names form the Colors namespace 2021-12-08 16:35:11 +01:00
Olivier Goffart
dd3fa1c221 Make the BindingMap hold RefCell of the BindingExpression
This will allow later to be able to operate on the binding despite the
element is borrowed.

Since the Binding itself is in a RefCell, the analysis don't need to
be anymore.
To do this change, a small change in the binding_analysis logic was required
which means that we will now detect binding loop if a binding was causing
two binding loop. (before, only one binding loop was detected)
2021-11-11 11:14:59 +01:00
Olivier Goffart
2f1f697e08 Fix the tests after the last commit
Since we add a window earlier in the pass, the warning was no more shown

Also don't add a window in front of a PopupWindow
2021-11-04 10:23:56 +01:00
Olivier Goffart
64499498b0 Fix the syntax_tests
We now get an error in recursive functions, but that's not the point of this test
2021-11-02 11:59:02 +01:00
Olivier Goffart
8622dcb910 Do the default_geometry pass without inlining 2021-10-28 15:52:29 +02:00
Olivier Goffart
67dd409f87 Move a few more passes before inlining 2021-10-28 15:52:29 +02:00
Olivier Goffart
5f07678478 Make the layout pass work on non-inlined tree 2021-10-28 15:52:29 +02:00
Olivier Goffart
b99ff1b766 Put filename in quote in import errors
So that the `debug_assert!` that fires when a error message ends with a
period does not crash the LSP when typing an incomplete filename that ends
with a '.'
2021-10-07 14:44:12 +02:00
Simon Hausmann
2ecf6c61d4 Minor cleanup: include the path in the error message when embedding an image fails 2021-10-06 09:44:06 +02:00
Olivier Goffart
521bf192f8 Improve error message for parse error
print the literal token symbol instead of the internal token name
2021-10-06 08:54:14 +02:00
Simon Hausmann
517b731e7b Fix CI build
Turn message about inability to embed images into a warning for now

We do test our tutorial and in the CI build we enforce embedding,
so the icon paths there don't work.
2021-10-05 23:16:46 +02:00
Simon Hausmann
88ad176008 Improve diagnostics when images cannot be located for embedding
This is a two-stage change, that first centralizes the file I/O code
path for on-disk and builtin:/ files. Secondly the resource embedding
pass now produces diagnostics if a file cannot be located.
2021-10-05 23:16:46 +02:00
Olivier Goffart
80d7b2ebe8 Hard error when not calling a callback
While before it was silently ignored or caused error in the generated code.

Fixes #542
2021-10-05 12:56:26 +02:00
Olivier Goffart
ae3e1b4680 Allow normal Element to be in the Dialog's button row with dialog-button-role 2021-10-05 09:46:20 +02:00
Simon Hausmann
d3dfd43bdc Tweak dialog error messages
Replace "should" with "must"/"can only" to emphasize that this is an error.
2021-09-30 11:27:50 +02:00
Olivier Goffart
7db9f3dfa9 Dialog: automatically add clicked callback for the standard button
And make the viewer listen to them and set them to automatically close dialogs
2021-09-30 10:21:13 +02:00
Olivier Goffart
7f05bfa309 Add the Dialog element 2021-09-29 16:25:44 +02:00
Simon Hausmann
5ee005c972 Fix panic in LSP when declaring animation on layout controlled property
When an animate foo {} declaration ends up creating an synthetic, invalid BindingExpression,
we still need to give it a span, to ensure that the diagnostics
produced later have *some* location set.

Fixes #515
2021-09-22 16:01:29 +02:00
Olivier Goffart
8d15bc1427 Parser: make the parentheses around if element optional
closes #466
2021-09-07 10:57:08 +02:00
Simon Hausmann
4d3f08d954 Allow global singletons to have default callback handlers
It's already working, we just need to remove the error handling :-)

Fixes #467
2021-09-06 13:56:27 +02:00
Simon Hausmann
ab522eb147 Produce errors when exporting a name multiple times 2021-08-31 10:19:50 +02:00
Simon Hausmann
c3ca796b1d Fix missing compiler warning about duplicated ids when using id more than twice
Don't remove the id of a duplicate from the seen set, as it may appear
again.
2021-08-30 20:35:31 +02:00
Tobias Hunger
aea4ecca99 Apply pre-commit hooks to all files 2021-08-17 22:38:16 +02:00
Olivier Goffart
d5b1a95f74 Turn the "duplicated id" error into a warning
Just for compatibility reason with 0.1.0, this is going to be turned
back into an error at a later point
2021-08-12 13:47:11 +02:00
Olivier Goffart
c25538c982 Normalize identifiers to - instead of _
As a result
 - The error messages will now show the error with `-` instead of `_`
 - The LSP will auto-complete with -
 - The interpreter's list of properties will list the property with '-'
   (but we made the change so that set_property, get_property, and so on
   work also if passed a '-')
2021-08-10 22:21:01 +02:00
Olivier Goffart
b6137ecbc4 Error when trying to use internal builtin items 2021-08-09 17:43:22 +02:00
Olivier Goffart
fa770ec262 Fix panic when one of the two branch of a condition is Type::Void
Throw a proper compilation error.
Note that there may be a bit too many error now when the two
branch of a condition are not the same, but it's better than a panic
2021-08-06 19:44:05 +02:00
Olivier Goffart
a89d83e58f Apply suggestions from code review
Co-authored-by: Simon Hausmann <simon.hausmann@sixtyfps.io>
2021-08-06 15:58:13 +02:00
Olivier Goffart
b5f34fd1d7 Make it an error to use dynamic tabs in the TabWidget 2021-08-06 15:58:13 +02:00
Olivier Goffart
d41839abe3 Compiler pass for the TabWidget
it will lower the TabWidget into a TabWidgetImpl and the tabs into TabImpl
2021-08-06 15:58:13 +02:00
Olivier Goffart
6a32a8b37a Don't error on empty documents 2021-07-29 17:40:20 +02:00
Olivier Goffart
bd52f4d444 Allow the clip property to be a dynamic property 2021-07-29 15:02:25 +02:00
Olivier Goffart
09c36ae965 Test for commit e0fad7fbdf 2021-07-29 13:25:47 +02:00
Simon Hausmann
fd26dd4944 Fix expected error messages
Amends a3652e6823
2021-07-28 17:08:27 +02:00
Simon Hausmann
e8727e98c5 Produce an error message when using if or for in grid layouts
An early error is better than a build error at compile time of generated code.
2021-07-28 17:08:27 +02:00
Olivier Goffart
be37a9f69a Allow angle and duration in the public API snce we document it 2021-07-26 17:36:02 +02:00
Olivier Goffart
ae210e79ec Properly handle self assignment on non-float types 2021-07-23 16:33:50 +02:00
Simon Hausmann
4f13238ff5 Fix preview on rectangles with opacity or drop shadow
Instead of producing an error, produce just a warning that the effect won't
be visible on root elements.
2021-07-23 11:41:28 +02:00
Olivier Goffart
f7923bfb77 Fix an error ending by a period
Reword the error because we might not even have an identifier
2021-07-22 14:38:58 +02:00
Olivier Goffart
f5de7e00a0 Make sure error messages don't end with '.'
As suggested in https://github.com/sixtyfpsui/sixtyfps/pull/275#issuecomment-881240725
2021-07-16 12:39:50 +02:00
Olivier Goffart
920903ad19 Throw an error if there are duplicated id in a component 2021-07-07 12:31:40 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00