diff options
author | Nick Schrader <nick.schrader@mailbox.org> | 2020-03-27 13:12:09 -0300 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-06-02 13:02:42 +0200 |
commit | 35f72f3ecdf0d61d0e67cd4f72c29fee2c3c9a55 (patch) | |
tree | 07beb54a046a765a3e19ed2ad138dc166e74a5e9 /vala/valasymbolresolver.vala | |
parent | ed320c6260bfa369f64f41450bc48fd5b664809a (diff) | |
download | vala-35f72f3ecdf0d61d0e67cd4f72c29fee2c3c9a55.tar.gz |
Add support for "with" statement
Creates data type scoped blocks which allow implicit member access to
the given expression or declaration statement.
with (expr) {
...;
}
Within the with-block the expression's members can be directly accessed
without the member access operator.
Members may hide local, class and instance varibales with the same name.
Instance variables are still accessible through this.
A local variable can be directly declared in the with statement header.
Hidden local and class variables are currently not directly accessible
(using this for class members generates the expected warning).
Fixes https://gitlab.gnome.org/GNOME/vala/issues/327
Diffstat (limited to 'vala/valasymbolresolver.vala')
-rw-r--r-- | vala/valasymbolresolver.vala | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala index dbe9b1f21..28365127a 100644 --- a/vala/valasymbolresolver.vala +++ b/vala/valasymbolresolver.vala @@ -480,6 +480,10 @@ public class Vala.SymbolResolver : CodeVisitor { list.accept_children (this); } + public override void visit_with_statement (WithStatement stmt) { + stmt.accept_children (this); + } + public override void visit_expression_statement (ExpressionStatement stmt) { if (stmt.checked) { return; |