[gobject-introspection/wip/transformer] [primarytransformer] A few annotation application fixes
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/transformer] [primarytransformer] A few annotation application fixes
- Date: Wed, 28 Jul 2010 21:41:30 +0000 (UTC)
commit dddd18f8aeba0940fe0cc6592050888515361b61
Author: Colin Walters <walters verbum org>
Date: Wed Jul 28 17:41:40 2010 -0400
[primarytransformer] A few annotation application fixes
giscanner/primarytransformer.py | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/giscanner/primarytransformer.py b/giscanner/primarytransformer.py
index 86d0d44..ce8e1f2 100644
--- a/giscanner/primarytransformer.py
+++ b/giscanner/primarytransformer.py
@@ -110,6 +110,9 @@ class PrimaryTransformer(object):
if isinstance(node, Function):
block = self._blocks.get(node.symbol)
self._apply_annotations_callable(node, chain, block)
+ if isinstance(node, Callback):
+ block = self._blocks.get(node.c_name)
+ self._apply_annotations_callable(node, chain, block)
if isinstance(node, (Class, Interface, Record, Union, Enum, Bitfield,
Callback)):
block = self._blocks.get(node.c_name)
@@ -372,7 +375,10 @@ class PrimaryTransformer(object):
node.foreign = True
def _apply_annotations_param(self, parent, param, tag):
- options = getattr(tag, 'options', {})
+ if tag:
+ options = tag.options
+ else:
+ options = {}
if isinstance(parent, Function):
scope = options.get(OPT_SCOPE)
if scope:
@@ -409,9 +415,10 @@ class PrimaryTransformer(object):
self._apply_annotations_param_ret_common(parent, param, tag)
def _apply_annotations_return(self, parent, return_, block):
- if not block:
- return
- tag = block.get(TAG_RETURNS)
+ if block:
+ tag = block.get(TAG_RETURNS)
+ else:
+ tag = None
self._apply_annotations_param_ret_common(parent, return_, tag)
def _check_arg_annotations(self, parent, params, block):
@@ -429,10 +436,11 @@ class PrimaryTransformer(object):
def _apply_annotations_params(self, parent, params, block):
self._check_arg_annotations(parent, params, block)
- if not block:
- return
for param in params:
- tag = block.get(param.argname)
+ if block:
+ tag = block.get(param.argname)
+ else:
+ tag = None
self._apply_annotations_param(parent, param, tag)
def _apply_annotations_callable(self, node, chain, block):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]