diff options
author | Simon Werbeck <simon.werbeck@gmail.com> | 2020-03-19 15:20:39 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-01-19 15:27:57 +0100 |
commit | 19ed5651a3f4a573934d58120be056b62102f554 (patch) | |
tree | c898d89331c4fb65b465e19266f57ea503381801 /vala/valaproperty.vala | |
parent | 0fb03903a39d7c0d911d88d9baad3d7d9315cc23 (diff) | |
download | vala-19ed5651a3f4a573934d58120be056b62102f554.tar.gz |
Add support for 'opaque' compact classes
This change intruduces a new attribute switch [Compact (opaque = true)]
which allows to completely hide the implementation of a compact class.
This is especially useful for libraries when maintaining a stable abi.
An 'opaque' compact class exposes no struct definition in the generated
c header, only a typedef is provided. As such, certain requirements
apply for members of such classes:
- Access to instance fields must be either private or internal.
- No abstract/virtual methods or properties are allowed.
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1129
Diffstat (limited to 'vala/valaproperty.vala')
-rw-r--r-- | vala/valaproperty.vala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala index 0a2e437d5..f07f137e0 100644 --- a/vala/valaproperty.vala +++ b/vala/valaproperty.vala @@ -424,6 +424,11 @@ public class Vala.Property : Symbol, Lockable { Report.error (source_reference, "Abstract and virtual properties may not be declared in derived compact classes"); return false; } + if (cl.is_opaque) { + error = true; + Report.error (source_reference, "Abstract and virtual properties may not be declared in opaque compact classes"); + return false; + } } if (is_abstract) { |