Commit graph

685 commits

Author SHA1 Message Date
Olivier Goffart
9891779022 Fix the C++ property 2020-05-28 15:25:56 +02:00
Simon Hausmann
b8a8abcdf9 Make the plus minus use-case work with the Rust frontend
Initialize the counter label from a property that we modify in signals handlers
from Rust code.
2020-05-28 15:20:30 +02:00
Simon Hausmann
993caa1cd4 Fix conversion from float to string in Rust frontend
Use as_str() to fix the compilation and call the macro with a bang :)
2020-05-28 15:20:30 +02:00
Simon Hausmann
97dc677854 Emit signal handler bindings and expressions for emitting signals in the Rust frontend 2020-05-28 15:20:30 +02:00
Simon Hausmann
a3892ea102 Emit declared signals in the rust frontend 2020-05-28 15:20:30 +02:00
Olivier Goffart
38329361b6 Use Property::set in C++ for constant bindings 2020-05-28 14:58:08 +02:00
Olivier Goffart
74898a1386 Make property conneciton binding in the C++
(somehow plus/minus is not working yet)
2020-05-28 14:52:43 +02:00
Simon Hausmann
e227f8a46e Use both set() and set_binding() in the rust frontend
When an expression holds just a constant value, then we can avoid creating a binding.
2020-05-28 14:41:15 +02:00
Olivier Goffart
f6d1151832 Use the EvaluationContext in the signal handler 2020-05-28 14:26:35 +02:00
Olivier Goffart
e86a7d3192 Merge signal and property declaration
A Signal is just a property of type Type::Signal

Simplifies the code a bit
2020-05-28 12:49:18 +02:00
Olivier Goffart
95b671c97c Support for code blocks and signal call 2020-05-28 12:30:08 +02:00
Simon Hausmann
f2df9293a9 Fix the C++ build
Remove the Optional from the evaluation context passing for property
evaluation. Unfortunately there are nullptr uses left on the C++ side,
that need to be replaced with passing through.
2020-05-28 12:07:11 +02:00
Simon Hausmann
4f9c53879b Implement property references as bindings in the Rust frontend 2020-05-28 11:37:59 +02:00
Simon Hausmann
f1adf323c2 Introduce the use of EvaluationContext in the viewer 2020-05-28 09:20:11 +02:00
Simon Hausmann
daf23f8736 Pass the evaluation context through the binding closure 2020-05-28 09:20:11 +02:00
Simon Hausmann
c4dd857e0d Add an evaluation context to property evaluations
The context is not used yet or passed on to the binding closure.
2020-05-28 09:20:11 +02:00
Olivier Goffart
8c39ada671 Add downcast method to VRef and VRefMut 2020-05-28 09:18:28 +02:00
Olivier Goffart
f27816a450 Recurse into the expressions in the passes 2020-05-28 08:01:33 +02:00
Olivier Goffart
92697ec6b0 Add some code to parse statements in blocks (separated with semicolon) 2020-05-28 07:22:08 +02:00
Olivier Goffart
250b0a2e5b Rust macro: get the right span for the diagnostics
Merge the features proc_macro_span and proc_macro_diagnostics, they are the same.
2020-05-27 18:37:45 +02:00
Olivier Goffart
42cddf2925 Add the conversion test 2020-05-27 16:46:31 +02:00
Olivier Goffart
5580b5112f Fix number to string conversion in C++ 2020-05-27 16:18:08 +02:00
Olivier Goffart
486b2ab8f8 Do type checking and convert from number to string 2020-05-27 15:43:45 +02:00
Simon Hausmann
c8b64f5c4b Remove the lowering
The LoweredItem and LoweredComponent contained, in essence, the same
information as the Element and Component in object_tree. Since the
moving declarations pass moved everything to the root element and the
LoweredPropertyDeclarations have been removed as well, this is the last
step.
2020-05-27 14:45:35 +02:00
Olivier Goffart
1389afda0d viewer: handle property references
Note: Currently, the bindings are set as constant value, not as bindings

Since the setting  of property happen in a indeterminate order, the value depending on other are currently undeterminate
2020-05-27 11:35:58 +02:00
Olivier Goffart
b084491878 Start working on trying to get custom properties working for the viewer 2020-05-27 11:33:20 +02:00
Simon Hausmann
32990e15e2 Remove LoweredPropertyDeclaration
This type that allowed indexing the property declarations in the hierarchy
to the properties moved to the root is not needed anymore.
For now a simple set remains in the LoweredItem to generate
correct accessor prefixes.
2020-05-27 11:13:58 +02:00
Olivier Goffart
41332a759f Make property reference works in C++ 2020-05-27 10:00:45 +02:00
Simon Hausmann
01fc0df1a2 Revert "Fix C++ build"
This reverts commit 6818ea746f.

The build was fine before this change. We don't call map_name() on the
root declarations, so this can't really happen.
2020-05-27 09:58:55 +02:00
Simon Hausmann
6818ea746f Fix C++ build
Don't rename the declarations in the root element.
2020-05-27 09:56:24 +02:00
Olivier Goffart
c137b4dab5 Add a pass to move all declaration on the top level 2020-05-27 09:37:46 +02:00
Olivier Goffart
3472674262 Add a pass to assign unique id to the elements 2020-05-27 08:20:52 +02:00
Simon Hausmann
0504ea566c Add support for declaring properties in Rust 2020-05-26 15:21:33 +02:00
Simon Hausmann
e77fe37568 Make it more convenient to deal with diagnostics in the Rust frontend
Provide a ToTokens implementation of Diagnostics by moving the code from the macro.
This makes it easier later to re-use the same logic to return
with diagnostics.
2020-05-26 15:17:18 +02:00
Olivier Goffart
36fb526811 Do inlining in a pass before the lowering 2020-05-26 15:10:27 +02:00
Olivier Goffart
b3d1a7196c Compile fix 2020-05-26 12:15:31 +02:00
Simon Hausmann
96d5165d28 Correctly report type conversion errors in the C++ backend
This requires a bit of error propagation, but now the errors are
reported correctly, in the unlikely event that they occur.
2020-05-26 11:45:22 +02:00
Olivier Goffart
a39a72b240 Fix the syntax_tests to actually match the regexp
The error regexp was not properly matched, being effectively ignoed.
Fixed that and the tests.
Added self tests to syntax_tests.
2020-05-26 11:24:37 +02:00
Olivier Goffart
7ba39f0a1c Make sure that we cannot override a property from the base 2020-05-26 11:23:54 +02:00
Olivier Goffart
4ea78134d8 Recactor the compiler so there are passes 2020-05-26 09:40:36 +02:00
Olivier Goffart
e8e1567975 Make the compiler actualy use the lib rather than re-declaring everything 2020-05-26 09:18:31 +02:00
Olivier Goffart
dee50a6fe8 More fixes to property lookup with components 2020-05-26 08:10:37 +02:00
Olivier Goffart
b12e63de52 Fix lookup of property within component 2020-05-26 07:43:12 +02:00
Simon Hausmann
0932953ac8 Implement property declarations for the C++ backend 2020-05-25 19:13:52 +02:00
Olivier Goffart
5a7a95dbc8 Make sure that we do not recognize ': =' or '= >' as one token 2020-05-25 18:15:06 +02:00
Olivier Goffart
e34ac8c3f4 Get signals and toucharea working on the rust example 2020-05-25 17:41:24 +02:00
Olivier Goffart
905f6c7b15 Fix signal lookup for now
Real signal lookup is still not implemented, any identifier for a signal property is considered as a signal
2020-05-25 17:34:38 +02:00
Olivier Goffart
9e4c355fa1 Lookup of quallified id 2020-05-25 17:24:31 +02:00
Simon Hausmann
1efa80882e Parse initializers for property declarations 2020-05-25 16:42:09 +02:00
Simon Hausmann
b3ee72b6c5 Permit bindings on declared properties
At least syntactically :-)
2020-05-25 16:42:09 +02:00