Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for variables in value bindings #869

Merged
merged 8 commits into from
Mar 12, 2021
Merged

Conversation

exyi
Copy link
Member

@exyi exyi commented Aug 1, 2020

The syntax is val variableName = value; nextExpression.
The variable is not assignable again - it is always immutable.
Variable may shadow property names and variables defined ahead of it.
The variable may be accessed only in the nextExpression.

This version does not support automatic unwrapping Tasks.
We wanted to switch to using await in DotVVM 3 anyway, right?

see #776

@exyi
Copy link
Member Author

exyi commented Aug 1, 2020

The parser/resolver and value binding work is done. The PR is marked as WIP because static commands are not working right now.

@exyi exyi marked this pull request as ready for review August 10, 2020 16:56
@exyi
Copy link
Member Author

exyi commented Aug 10, 2020

It now should work even in static commands. Arguably, the translation is a bit messy, but it works - we can probably improve the output JS code later.

@exyi exyi changed the base branch from v3-master to main November 4, 2020 20:46
@tomasherceg tomasherceg added this to the Version 3.0 Nice to have milestone Nov 7, 2020
The syntax is `val variableName = value; nextExpression`.
The variable is not assignable again - it is always immutable.
Variable may shadow property names and variables defined ahead of it.
The variable may be accessed only in the `nextExpression`.

This version does not support automatic unwrapping Tasks.
We wanted to switch to using await in DotVVM 3 anyway, right?

see #776
Copy link
Member

@acizmarik acizmarik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

@@ -934,6 +934,29 @@ public void BindingParser_MultiblockExpression_EmptyBlockMiddle_Invalid(string b
Assert.AreEqual(node.EndPosition, lastExpression.EndPosition);
Assert.AreEqual(voidBlockExpectedLenght, middleExpression.Length);

}
[DataRow("var x=A(); !x", "x", DisplayName = "Variable (val) expression")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

val instead of var in DisplayName

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@quigamdev quigamdev merged commit 7c06571 into main Mar 12, 2021
@quigamdev quigamdev deleted the variables-binding branch March 14, 2021 12:58
@tomasherceg tomasherceg modified the milestones: After 3.0, Version 3.0 Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants