diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-11-17 13:34:07 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-11-17 15:35:17 +0100 |
commit | 7b434af7c65e8837f8205c83c47e429a085a4483 (patch) | |
tree | a006ddfffa82d0a1359852149e64880b2be19ddb /vala/valagenieparser.vala | |
parent | d85d5fda1b2aedd0dea3a144fa442962bb452fc1 (diff) | |
download | vala-7b434af7c65e8837f8205c83c47e429a085a4483.tar.gz |
genieparser: Use dedicated Class.add_constructor/destructor() methods
Diffstat (limited to 'vala/valagenieparser.vala')
-rw-r--r-- | vala/valagenieparser.vala | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala index 93374b443..8ed3bab4d 100644 --- a/vala/valagenieparser.vala +++ b/vala/valagenieparser.vala @@ -2729,43 +2729,9 @@ public class Vala.Genie.Parser : CodeVisitor { } else if (sym is Property) { cl.add_property ((Property) sym); } else if (sym is Constructor) { - var c = (Constructor) sym; - if (c.binding == MemberBinding.INSTANCE) { - if (cl.constructor != null) { - Report.error (c.source_reference, "class already contains a constructor"); - } - cl.constructor = c; - } else if (c.binding == MemberBinding.CLASS) { - if (cl.class_constructor != null) { - Report.error (c.source_reference, "class already contains a class constructor"); - } - cl.class_constructor = c; - } else { - if (cl.static_constructor != null) { - Report.error (c.source_reference, "class already contains a static constructor"); - } - cl.static_constructor = c; - } - + cl.add_constructor ((Constructor) sym); } else if (sym is Destructor) { - var d = (Destructor) sym; - if (d.binding == MemberBinding.STATIC) { - if (cl.static_destructor != null) { - Report.error (d.source_reference, "class already contains a static destructor"); - } - cl.static_destructor = (Destructor) d; - } else if (d.binding == MemberBinding.CLASS) { - if (cl.class_destructor != null) { - Report.error (d.source_reference, "class already contains a class destructor"); - } - cl.class_destructor = (Destructor) d; - } else { - if (cl.destructor != null) { - Report.error (d.source_reference, "class already contains a destructor"); - } - cl.destructor = (Destructor) d; - } - + cl.add_destructor ((Destructor) sym); } else { Report.error (sym.source_reference, "unexpected declaration in class"); } |