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
|
@ -136,6 +136,14 @@ class GirType:
|
|||
def incomplete(self) -> bool:
|
||||
return False
|
||||
|
||||
@property
|
||||
def deprecated(self) -> bool:
|
||||
return False
|
||||
|
||||
@property
|
||||
def deprecated_doc(self) -> T.Optional[str]:
|
||||
return None
|
||||
|
||||
|
||||
class ExternType(GirType):
|
||||
def __init__(self, name: str) -> None:
|
||||
|
@ -330,6 +338,13 @@ class GirNode:
|
|||
def type(self) -> GirType:
|
||||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def deprecated_doc(self) -> T.Optional[str]:
|
||||
try:
|
||||
return self.xml.get_elements("doc-deprecated")[0].cdata.strip()
|
||||
except:
|
||||
return None
|
||||
|
||||
|
||||
class Property(GirNode):
|
||||
xml_tag = "property"
|
||||
|
@ -365,6 +380,10 @@ class Property(GirNode):
|
|||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def deprecated(self) -> bool:
|
||||
return self.tl.PROP_DEPRECATED == 1
|
||||
|
||||
|
||||
class Argument(GirNode):
|
||||
def __init__(self, container: GirNode, tl: typelib.Typelib) -> None:
|
||||
|
@ -427,6 +446,10 @@ class Signal(GirNode):
|
|||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def deprecated(self) -> bool:
|
||||
return self.tl.SIGNAL_DEPRECATED == 1
|
||||
|
||||
|
||||
class Interface(GirNode, GirType):
|
||||
xml_tag = "interface"
|
||||
|
@ -488,6 +511,10 @@ class Interface(GirNode, GirType):
|
|||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def deprecated(self) -> bool:
|
||||
return self.tl.INTERFACE_DEPRECATED == 1
|
||||
|
||||
|
||||
class Class(GirNode, GirType):
|
||||
xml_tag = "class"
|
||||
|
@ -609,6 +636,10 @@ class Class(GirNode, GirType):
|
|||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def deprecated(self) -> bool:
|
||||
return self.tl.OBJ_DEPRECATED == 1
|
||||
|
||||
|
||||
class TemplateType(GirType):
|
||||
def __init__(self, name: str, parent: T.Optional[GirType]):
|
||||
|
@ -722,6 +753,10 @@ class Enumeration(GirNode, GirType):
|
|||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def deprecated(self) -> bool:
|
||||
return self.tl.ENUM_DEPRECATED == 1
|
||||
|
||||
|
||||
class Boxed(GirNode, GirType):
|
||||
xml_tag = "glib:boxed"
|
||||
|
@ -743,6 +778,10 @@ class Boxed(GirNode, GirType):
|
|||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def deprecated(self) -> bool:
|
||||
return self.tl.STRUCT_DEPRECATED == 1
|
||||
|
||||
|
||||
class Bitfield(Enumeration):
|
||||
xml_tag = "bitfield"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue