From: Johan Bilien Date: Thu, 14 Jan 2010 22:02:36 +0000 (-0500) Subject: scanner: Always explicitely set the scope of callbacks X-Git-Tag: GOBJECT_INTROSPECTION_0_6_8~19 X-Git-Url: http://git.roojs.org/?p=gnome.gobject-introspection;a=commitdiff_plain;h=18d8b801792595760e2695dedae868db6e5b22d8 scanner: Always explicitely set the scope of callbacks default to 'call' as stated in the annotation documentation. https://bugzilla.gnome.org/show_bug.cgi?id=607026 --- diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir index 5bb6c18..145a9c9 100644 --- a/gir/Everything-1.0-expected.gir +++ b/gir/Everything-1.0-expected.gir @@ -698,7 +698,7 @@ is invoked."> - + diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py index d91bb1c..aa04ef4 100644 --- a/giscanner/annotationparser.py +++ b/giscanner/annotationparser.py @@ -507,7 +507,7 @@ class AnnotationApplier(object): def _parse_param(self, parent, param, tag): options = getattr(tag, 'options', {}) - if isinstance(parent, Function) and not param.scope: + if isinstance(parent, Function): scope = options.get(OPT_SCOPE) if scope: param.scope = scope.one() diff --git a/giscanner/transformer.py b/giscanner/transformer.py index 1024ee3..f31408f 100644 --- a/giscanner/transformer.py +++ b/giscanner/transformer.py @@ -295,6 +295,10 @@ class Transformer(object): if not self._type_is_callback(param.type): continue + # set a default scope + if param.scope is None: + param.scope = 'call' + # j is the index where we look for closure/destroy to # group with the callback param j = i + 1 diff --git a/tests/scanner/annotation-1.0-expected.gir b/tests/scanner/annotation-1.0-expected.gir index 2eef210..ab81ae1 100644 --- a/tests/scanner/annotation-1.0-expected.gir +++ b/tests/scanner/annotation-1.0-expected.gir @@ -463,7 +463,7 @@ type."> - + @@ -555,12 +555,13 @@ detection, and fixing it via annotations."> - + diff --git a/tests/scanner/annotation-1.0-expected.tgir b/tests/scanner/annotation-1.0-expected.tgir index 1507174..9e9370b 100644 --- a/tests/scanner/annotation-1.0-expected.tgir +++ b/tests/scanner/annotation-1.0-expected.tgir @@ -345,7 +345,7 @@ - + @@ -409,10 +409,10 @@ - + - +