mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Emit deprecation warnings
This commit is contained in:
parent
8fab7c1706
commit
94db929f74
9 changed files with 102 additions and 2 deletions
|
@ -41,9 +41,11 @@ class Property(AstNode):
|
|||
return self.parent.parent.gir_class
|
||||
|
||||
@property
|
||||
def gir_property(self):
|
||||
def gir_property(self) -> T.Optional[gir.Property]:
|
||||
if self.gir_class is not None and not isinstance(self.gir_class, ExternType):
|
||||
return self.gir_class.properties.get(self.tokens["name"])
|
||||
else:
|
||||
return None
|
||||
|
||||
@validate()
|
||||
def binding_valid(self):
|
||||
|
@ -91,6 +93,17 @@ class Property(AstNode):
|
|||
check=lambda child: child.tokens["name"] == self.tokens["name"],
|
||||
)
|
||||
|
||||
@validate("name")
|
||||
def deprecated(self) -> None:
|
||||
if self.gir_property is not None and self.gir_property.deprecated:
|
||||
hints = []
|
||||
if self.gir_property.deprecated_doc:
|
||||
hints.append(self.gir_property.deprecated_doc)
|
||||
raise CompileWarning(
|
||||
f"{self.gir_property.signature} is deprecated",
|
||||
hints=hints,
|
||||
)
|
||||
|
||||
@docs("name")
|
||||
def property_docs(self):
|
||||
if self.gir_property is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue