diff options
author | Daniel Espinosa <esodan@gmail.com> | 2018-01-15 14:28:43 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-01-15 17:39:33 +0100 |
commit | 28b4f45b709622e821e86655f245fdcb75d3afaf (patch) | |
tree | 11cde52852a02421d9ef9f6c3876e198afc2d8c1 /vala/valaproperty.vala | |
parent | 1a5cb4b04814797956675e442e9f24a2b39f1b34 (diff) | |
download | vala-28b4f45b709622e821e86655f245fdcb75d3afaf.tar.gz |
codegen: Add support for abstract/virtual methods and properties in compact classes
Reworked and extened by Rico Tzschichholz
https://bugzilla.gnome.org/show_bug.cgi?id=741465
Diffstat (limited to 'vala/valaproperty.vala')
-rw-r--r-- | vala/valaproperty.vala | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala index 0968600dd..e0a8e4390 100644 --- a/vala/valaproperty.vala +++ b/vala/valaproperty.vala @@ -382,6 +382,15 @@ public class Vala.Property : Symbol, Lockable { checked = true; + if (parent_symbol is Class && (is_abstract || is_virtual)) { + var cl = (Class) parent_symbol; + if (cl.is_compact && cl.base_class != null) { + error = true; + Report.error (source_reference, "Abstract and virtual properties may not be declared in derived compact classes"); + return false; + } + } + if (is_abstract) { if (parent_symbol is Class) { var cl = (Class) parent_symbol; @@ -401,15 +410,6 @@ public class Vala.Property : Symbol, Lockable { Report.error (source_reference, "Virtual properties may not be declared outside of classes and interfaces"); return false; } - - if (parent_symbol is Class) { - var cl = (Class) parent_symbol; - if (cl.is_compact) { - error = true; - Report.error (source_reference, "Virtual properties may not be declared in compact classes"); - return false; - } - } } else if (overrides) { if (!(parent_symbol is Class)) { error = true; |