summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-03-27 17:33:52 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2013-05-07 13:28:54 -0400
commita0185528a17378b6e6e7bc458f34b1f3719cc420 (patch)
treeb9f8a5e0d0cfe9f5a989df30e9349d5d542eeea3
parent97da62989712c1105198819c7a9481657d9d335b (diff)
downloadgobject-introspection-a0185528a17378b6e6e7bc458f34b1f3719cc420.tar.gz
annotationparser: Remove get_tag/get_param
They're useless if we can just access the dict directly. https://bugzilla.gnome.org/show_bug.cgi?id=688897
-rw-r--r--giscanner/annotationparser.py6
-rw-r--r--giscanner/introspectablepass.py2
-rw-r--r--giscanner/maintransformer.py34
3 files changed, 18 insertions, 24 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index ef9cd31d..c0b439a1 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -378,12 +378,6 @@ class DocBlock(object):
def __repr__(self):
return '<DocBlock %r %r>' % (self.name, self.options)
- def get_tag(self, name):
- return self.tags.get(name)
-
- def get_param(self, name):
- return self.params.get(name)
-
def to_gtk_doc(self):
options = ''
if self.options:
diff --git a/giscanner/introspectablepass.py b/giscanner/introspectablepass.py
index 460c8200..3e295391 100644
--- a/giscanner/introspectablepass.py
+++ b/giscanner/introspectablepass.py
@@ -58,7 +58,7 @@ class IntrospectablePass(object):
else:
context = "return value: "
if block:
- return_tag = block.get_tag(TAG_RETURNS)
+ return_tag = block.tags.get(TAG_RETURNS)
if return_tag:
position = return_tag.position
message.warn_node(parent, prefix + context + text,
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index d2a8be7b..28ffed36 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -135,7 +135,7 @@ usage is void (*_gtk_reserved1)(void);"""
def _apply_annotation_rename_to(self, node, chain, block):
if not block:
return
- rename_to = block.get_tag(TAG_RENAME_TO)
+ rename_to = block.tags.get(TAG_RENAME_TO)
if not rename_to:
return
rename_to = rename_to.value
@@ -227,13 +227,13 @@ usage is void (*_gtk_reserved1)(void);"""
if isinstance(node, ast.Class):
block = self._get_block(node)
if block:
- tag = block.get_tag(TAG_UNREF_FUNC)
+ tag = block.tags.get(TAG_UNREF_FUNC)
node.unref_func = tag.value if tag else None
- tag = block.get_tag(TAG_REF_FUNC)
+ tag = block.tags.get(TAG_REF_FUNC)
node.ref_func = tag.value if tag else None
- tag = block.get_tag(TAG_SET_VALUE_FUNC)
+ tag = block.tags.get(TAG_SET_VALUE_FUNC)
node.set_value_func = tag.value if tag else None
- tag = block.get_tag(TAG_GET_VALUE_FUNC)
+ tag = block.tags.get(TAG_GET_VALUE_FUNC)
node.get_value_func = tag.value if tag else None
if isinstance(node, ast.Constant):
self._apply_annotations_constant(node)
@@ -595,11 +595,11 @@ usage is void (*_gtk_reserved1)(void);"""
node.doc = block.comment if block.comment else ''
- since_tag = block.get_tag(TAG_SINCE)
+ since_tag = block.tags.get(TAG_SINCE)
if since_tag is not None:
node.version = since_tag.value
- deprecated_tag = block.get_tag(TAG_DEPRECATED)
+ deprecated_tag = block.tags.get(TAG_DEPRECATED)
if deprecated_tag is not None:
value = deprecated_tag.value
if ': ' in value:
@@ -613,7 +613,7 @@ usage is void (*_gtk_reserved1)(void);"""
if version is not None:
node.deprecated_version = version
- stability_tag = block.get_tag(TAG_STABILITY)
+ stability_tag = block.tags.get(TAG_STABILITY)
if stability_tag is not None:
stability = stability_tag.value.capitalize()
if stability in ["Stable", "Unstable", "Private", "Internal"]:
@@ -622,7 +622,7 @@ usage is void (*_gtk_reserved1)(void);"""
message.warn('unknown value "%s" for Stability tag' % (
stability_tag.value), stability_tag.position)
- annos_tag = block.get_tag(TAG_ATTRIBUTES)
+ annos_tag = block.tags.get(TAG_ATTRIBUTES)
if annos_tag is not None:
for key, value in annos_tag.options.items():
if value:
@@ -684,7 +684,7 @@ usage is void (*_gtk_reserved1)(void);"""
def _apply_annotations_return(self, parent, return_, block):
if block:
- tag = block.get_tag(TAG_RETURNS)
+ tag = block.tags.get(TAG_RETURNS)
else:
tag = None
self._apply_annotations_param_ret_common(parent, return_, tag)
@@ -695,7 +695,7 @@ usage is void (*_gtk_reserved1)(void);"""
declparams.add(parent.instance_parameter.argname)
for param in params:
if block:
- tag = block.get_param(param.argname)
+ tag = block.params.get(param.argname)
else:
tag = None
self._apply_annotations_param(parent, param, tag)
@@ -721,7 +721,7 @@ usage is void (*_gtk_reserved1)(void);"""
text = ', should be one of %s' % (
', '.join(repr(p) for p in unused), )
- tag = block.get_param(doc_name)
+ tag = block.params.get(doc_name)
message.warn(
'%s: unknown parameter %r in documentation comment%s' % (
block.name, doc_name, text),
@@ -749,7 +749,7 @@ usage is void (*_gtk_reserved1)(void);"""
def _apply_annotations_field(self, parent, block, field):
if not block:
return
- tag = block.get_param(field.name)
+ tag = block.params.get(field.name)
if not tag:
return
t = tag.options.get(OPT_TYPE)
@@ -767,7 +767,7 @@ usage is void (*_gtk_reserved1)(void);"""
self._apply_annotations_annotated(prop, block)
if not block:
return
- transfer_tag = block.get_tag(TAG_TRANSFER)
+ transfer_tag = block.tags.get(TAG_TRANSFER)
if transfer_tag is not None:
transfer = transfer_tag.value
if transfer == OPT_TRANSFER_FLOATING:
@@ -775,7 +775,7 @@ usage is void (*_gtk_reserved1)(void);"""
prop.transfer = transfer
else:
prop.transfer = self._get_transfer_default(parent, prop)
- type_tag = block.get_tag(TAG_TYPE)
+ type_tag = block.tags.get(TAG_TYPE)
if type_tag:
prop.type = self._resolve_toplevel(type_tag.value, prop.type, prop, parent)
@@ -814,7 +814,7 @@ usage is void (*_gtk_reserved1)(void);"""
self._apply_annotations_annotated(node, block)
- tag = block.get_tag(TAG_VALUE)
+ tag = block.tags.get(TAG_VALUE)
if tag:
node.value = tag.value
@@ -836,7 +836,7 @@ usage is void (*_gtk_reserved1)(void);"""
# Handle virtual invokers
parent = chain[-1] if chain else None
if (block and parent):
- virtual_annotation = block.get_tag(TAG_VFUNC)
+ virtual_annotation = block.tags.get(TAG_VFUNC)
if virtual_annotation:
invoker_name = virtual_annotation.value
matched = False