Commit graph

197 commits

Author SHA1 Message Date
Olivier Goffart
a2e74f9df2 Test and fixe error involving invalid array access 2022-01-14 13:38:25 +01:00
James Blacklock
7ad1ba209d Add support for array index expressions
This is a squash of the changes in
https://github.com/sixtyfpsui/sixtyfps/pull/605
2022-01-14 13:38:25 +01:00
Olivier Goffart
b078fffc44 Parser: allow . to access member after any expression
Before we would only allow `foo.bar` where `foo` was an identifier.
Now we also allow more complex expression such as `"foo".bar` or `(123 + foo).bar`
(in the parser)
In particular, this will allow to get the member of objects returned by functions
or, in the future, part of arrays
2022-01-13 17:49:16 +01:00
Tobias Hunger
4c331f1ac2
janitor: More clippy fixes
None of these should be controversial: It is all similar to quick fixes
I pushed before.
2022-01-09 14:50:58 +01:00
Tobias Hunger
2d2c560220 janitor: Remove unnecessary return statements
Some of these actually seem to make some stylistc sense
2022-01-09 13:46:33 +01:00
Tobias Hunger
3e448f75eb
janitor: Remove some unnecessary references
These are immediently dereferenced by the compiler according to clippy.

Remove some now unnecessary muts to make things build again.
2022-01-04 18:22:15 +01:00
Tobias Hunger
c89fa46b2c
janitor: Remove some redundent clone() calls 2022-01-04 18:20:24 +01:00
Tobias Hunger
bfca0e3573 Mass update copyright messages to be more REUSE compliant 2021-12-22 10:06:12 +01:00
Olivier Goffart
0436ce2399 Allow to access color names form the Colors namespace 2021-12-08 16:35:11 +01:00
Olivier Goffart
639c358896 Refactor the LookupResult
Separate Enumeration and Expression, so get rid of the isize::MAX hack
And this will allow having more non-expression results (eg: namespaces)
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
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
b42c187ed1 Refactor the way the two-ways biding are represented internaly
Don't put them in a fake expression.
This simplifies a bit the expression handling, and will make
possible to fix analysis that needs a vew into the aliases
2021-08-20 18:26:36 +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
Tobias Hunger
bac4d895ce Janitor: Fix clippy::while_let_on_iterator 2021-08-09 13:19:34 +02:00
Tobias Hunger
ec7b7f751b Janitor: Fix clippy::or_fun_call 2021-07-30 09:27:48 +02:00
Tobias Hunger
e5bb7762b9 Janitor: Fix clippy::useless_conversion 2021-07-30 09:27:48 +02:00
Olivier Goffart
74bc9521b9 Fix the scope while resolving a model expression
The `self` was always referring to the `root` instead of the enclosing
element.
2021-07-26 11:08:46 +02:00
Olivier Goffart
ac751c1052 Re-arrenge a match
looks prettier this way
2021-07-23 17:11:54 +02:00
Olivier Goffart
ae210e79ec Properly handle self assignment on non-float types 2021-07-23 16:33:50 +02:00
Tobias Hunger
d64291245e Janitor: Fix clippy::len_zero 2021-07-23 13:48:52 +02:00
Olivier Goffart
c2433d0f0b Fix panic when parsing linear-gradient with a trailing coma 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
Tobias Hunger
bf48a6c65e Janitor: Remove some unnecessary returns 2021-07-08 20:43:38 +02:00
Tobias Hunger
ac2d17e8e4 Janitor: Remove unnecessary format! 2021-07-06 22:34:21 +02:00
Tobias Hunger
56885bd71d Janitor: Remove useless type conversion 2021-07-06 22:34:21 +02:00
Tobias Hunger
af0f193f1d Janitor: Fix clippy::if_same_then_else error
In this case this feels at controversial, but in general I find this
clippy lint pretty helpful: It has caught several copy-paste errors
before.

No behavior change is intended with this patch.
2021-07-06 21:28:36 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Tobias Hunger
13d7f5e7bd Janitor: Fix typos in comments and user-facing strings
Also adapt tests for error messages containing the fixed strings.

No behavior change is intended!
2021-06-28 08:32:25 +02:00
Tobias Hunger
24872e2604 Janitor: Fix typo in in local function name
No behavior change is intended.
2021-06-28 08:32:00 +02:00
Olivier Goffart
ce34ff87d0 Finish support for callback aliases
cc #111
2021-06-07 20:40:36 +02:00
Olivier Goffart
3ddc3c6ce5 Don't re-use Type::Void for inferred type
Make it explicit that it is inferred, and differentiate callback and property
2021-06-07 20:40:36 +02:00
Olivier Goffart
7384d334c1 WIP: parse callback aliases 2021-06-07 20:40:36 +02:00
Olivier Goffart
6a4cd0087f Apply suggestions from code review
Co-authored-by: Simon Hausmann <simon.hausmann@sixtyfps.io>
2021-06-07 10:48:09 +02:00
Olivier Goffart
715d38903f Allow to omit the type of aliases 2021-06-07 10:48:09 +02:00
Olivier Goffart
77b8bb615f Move some code in a new module 2021-06-01 12:50:29 +02:00
Olivier Goffart
a1880bd943 Report an error when trying to convert from logical to physical coordinate in a global 2021-05-20 18:11:58 +02:00
Olivier Goffart
54be5f3a84 Some ground work to make more binding analysis
- Mark builtin properties that are modified by the native code as output
 - Record wether the property is set by code in the .60
 - Add a field that will tell us if a property binding is constant
2021-05-20 13:40:51 +02:00
Olivier Goffart
c39cb48125 Move builtin types builtin function lookup in the lookup module
This way these function can also be auto-completed
2021-05-12 22:21:08 +02:00
Olivier Goffart
d7d9badc93 Fix panic when using some value from an invalid component in a imported file 2021-05-07 18:28:23 +02:00
Olivier Goffart
f620351cbf Go to definition of structs
Also add the struct in the outline
2021-04-24 15:06:58 +02:00
Olivier Goffart
91ed04a72c Make length (still the default for all property) be the logical length
And a new `physical_length` is now the physical_length unit

Note: this does not change the runtime part yet
2021-04-21 17:15:19 +02:00
Olivier Goffart
7ae850d564 Rename Type::Length -> Type::PhysicalLength 2021-04-21 17:15:19 +02:00
Olivier Goffart
59654472d2 LSP: color providers 2021-04-18 23:27:14 +02:00
Olivier Goffart
069b5aa1a1 Refactor lookup
Share some code so we can eaily list all possibilities and we will use that
in the LSP for the completion
2021-04-16 23:41:59 +02:00
Olivier Goffart
ad298a309f WIP: LSP autocompletion of expression 2021-04-16 23:41:59 +02:00
Olivier Goffart
6837086647 Fix compilation after rebase 2021-04-14 12:04:45 +02:00
Olivier Goffart
84e0b24550 Some refactoring of the syntax_nodes module
Ensure that the node always contains the write kind by panicking
if it doesn't.

Add some documentation for the macro that declares them
2021-04-14 11:46:49 +02:00
Simon Hausmann
a92c9196eb Typeloader cleanup
There are currently two places where we resolve relative file names,
once in the import handling and once when processing @image-url.

Both places called first `loader.find_file_in_include_path` and then `resolve_import_path`,
which this patch combines into one function.

That will make it easier (and less error-prone) for future call sites.
2021-04-14 09:01:52 +02:00