Apply suggestions from code review

Co-authored-by: Simon Hausmann <simon.hausmann@sixtyfps.io>
This commit is contained in:
Olivier Goffart 2021-06-07 10:18:26 +02:00 committed by Olivier Goffart
parent 715d38903f
commit 6a4cd0087f
4 changed files with 5 additions and 4 deletions

View file

@ -168,13 +168,13 @@ Example := Button {
Using the `<=>` syntax, one can create two ways binding between properties. These properties are now linked
together.
The right hand side of the `<=>` must be a reference to a property of the same type.
The type can be omitted in a property declaration to have the type automatically infered.
The type can be omitted in a property declaration to have the type automatically inferred.
```60
Example := Window {
property<brush> rect_color <=> r.background;
// it is allowed to omit the type to have it automatically infered
// it is allowed to omit the type to have it automatically inferred
property rect_color2 <=> r.background;
r:= Rectangle {
width: parent.width;

View file

@ -221,7 +221,7 @@ impl Type {
| Self::Struct { .. }
| Self::Array(_)
| Self::Brush
| Self::Void // Void is not a valid type for property, but it is temporarily used for infered two ways bindings
| Self::Void // Void is not a valid type for property, but it is temporarily used for inferred two ways bindings
)
}

View file

@ -81,7 +81,7 @@ fn resolve_alias(
lookup_ctx.component_scope = &scope;
Expression::from_two_way_binding(node, &mut lookup_ctx)
}
_ => panic!("The parser should make sure that the expression is "),
_ => panic!("There should be a Uncompiled expression at this point."),
};
let mut ty = e.ty();

View file

@ -65,6 +65,7 @@ fn resolve_expression(
}
SyntaxKind::TwoWayBinding => {
if lookup_ctx.property_type == Type::Invalid {
// An attempt to resolve this already failed when trying to resolve the property type
assert!(diag.has_error());
return;
}