diff options
Diffstat (limited to 'vala/valasymbol.vala')
-rw-r--r-- | vala/valasymbol.vala | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala index 0ffd87206..5b1ef12a9 100644 --- a/vala/valasymbol.vala +++ b/vala/valasymbol.vala @@ -95,6 +95,11 @@ public abstract class Vala.Symbol : CodeNode { public string? replacement { get; set; default = null; } /** + * Specifies whether this symbol is experimental. + */ + public bool experimental { get; set; default = false; } + + /** * Specifies whether this symbol has been accessed. */ public bool used { get; set; } @@ -502,6 +507,32 @@ public abstract class Vala.Symbol : CodeNode { } /** + * Process a [Experimental] attribute + */ + public virtual void process_experimental_attribute (Attribute attr) { + if (attr.name != "Experimental") { + return; + } + + experimental = true; + } + + /** + * Check to see if the symbol is experimental, and emit a warning + * if it is. + */ + public bool check_experimental (SourceReference? source_ref = null) { + if (experimental) { + if (!CodeContext.get ().experimental) { + Report.experimental (source_ref, "%s is experimental".printf (get_full_name ())); + } + return true; + } else { + return false; + } + } + + /** * Sets the C header filename of this namespace to the specified * filename. * |