summaryrefslogtreecommitdiff
path: root/vala/valaproperty.vala
diff options
context:
space:
mode:
authorSimon Werbeck <simon.werbeck@gmail.com>2020-03-19 15:20:39 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2021-01-19 15:27:57 +0100
commit19ed5651a3f4a573934d58120be056b62102f554 (patch)
treec898d89331c4fb65b465e19266f57ea503381801 /vala/valaproperty.vala
parent0fb03903a39d7c0d911d88d9baad3d7d9315cc23 (diff)
downloadvala-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.vala5
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) {