[vala/wip/issue/658: 33/48] Reduced anonymous delegate syntax
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/issue/658: 33/48] Reduced anonymous delegate syntax
- Date: Sat, 31 Oct 2020 15:08:16 +0000 (UTC)
commit 65a75b89710b6c201af35417fa7ddf7cb5c975d9
Author: Nick Schrader <nick schrader mailbox org>
Date: Tue Oct 20 16:27:57 2020 -0300
Reduced anonymous delegate syntax
vala/valaparser.vala | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 77bbb9222..551c6251a 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -3701,7 +3701,11 @@ public class Vala.Parser : CodeVisitor {
Parameter parse_anonymous_parameter (int id) throws ParseError {
var attrs = parse_attributes ();
var begin = get_location ();
- bool params_array = accept (TokenType.PARAMS);
+
+ if (accept (TokenType.PARAMS)) {
+ Report.error (get_last_src (), "Params-arrays not allowed in anonymous delegates");
+ }
+
var direction = ParameterDirection.IN;
if (accept (TokenType.OUT)) {
direction = ParameterDirection.OUT;
@@ -3723,10 +3727,13 @@ public class Vala.Parser : CodeVisitor {
type = parse_inline_array_type (type);
+ if (accept (TokenType.ASSIGN)) {
+ Report.error (get_last_src (), "Optional paramters not allowed in anonymous
delegates");
+ }
+
var param = new Parameter ("p%i".printf (id), type, get_src (begin));
set_attributes (param, attrs);
param.direction = direction;
- param.params_array = params_array;
return param;
}
@@ -3737,7 +3744,6 @@ public class Vala.Parser : CodeVisitor {
var begin = get_location ();
expect (TokenType.DELEGATE);
- var type_param_list = parse_type_parameter_list ();
expect (TokenType.OPEN_PARENS);
var param_list = new ArrayList<Parameter>();
@@ -3755,11 +3761,7 @@ public class Vala.Parser : CodeVisitor {
var d = new Delegate ("__delegate%i_".printf (next_anonymous_id++), type, get_src (begin),
comment);
d.anonymous = true;
- //FIXME d.access = parent.access;
-
- foreach (var type_param in type_param_list) {
- d.add_type_parameter (type_param);
- }
+ d.access = method.access;
foreach (var param in param_list) {
d.add_parameter (param);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]