diff options
author | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-08-21 12:16:30 +0200 |
---|---|---|
committer | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-10-08 20:55:56 +0200 |
commit | 35278b955304eb62565b5578b6848494721847bd (patch) | |
tree | 101e6c9846232daaa36cc394c6f538912473e697 /giscanner/maintransformer.py | |
parent | 4ff3c660de64ba423659bd796fbd944b7af1913d (diff) | |
download | gobject-introspection-35278b955304eb62565b5578b6848494721847bd.tar.gz |
giscanner: refactor annotation validation
- annotations on the identifier (formerly g-i specific tags) have
never been validated before, so fix this
- removes duplicate validation code from GtkDocTag and GtkDocParameter
- remove repeated validation code doing the same thing as
annotationparser from maintransformer...
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r-- | giscanner/maintransformer.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index b4418b64..ebb2b88e 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -140,7 +140,7 @@ class MainTransformer(object): target = self._namespace.get_by_symbol(rename_to) if not target: message.warn_node(node, - "Can't find symbol %r referenced by Rename annotation" % (rename_to, )) + "Can't find symbol %r referenced by \"rename-to\" annotation" % (rename_to, )) elif target.shadowed_by: message.warn_node(node, "Function %r already shadowed by %r, can't overwrite " @@ -394,16 +394,12 @@ class MainTransformer(object): def _apply_annotations_element_type(self, parent, node, annotations): element_type_opt = annotations.get(ANN_ELEMENT_TYPE) if element_type_opt is None: - message.warn( - 'element-type annotation takes at least one option, ' - 'none given', - annotations.position) return if isinstance(node.type, ast.List): if len(element_type_opt) != 1: message.warn( - 'element-type annotation for a list must have exactly ' + '"element-type" annotation for a list must have exactly ' 'one option, not %d options' % (len(element_type_opt), ), annotations.position) return @@ -412,7 +408,7 @@ class MainTransformer(object): elif isinstance(node.type, ast.Map): if len(element_type_opt) != 2: message.warn( - 'element-type annotation for a hash table must have exactly ' + '"element-type" annotation for a hash table must have exactly ' 'two options, not %d option(s)' % (len(element_type_opt), ), annotations.position) return @@ -423,15 +419,16 @@ class MainTransformer(object): elif isinstance(node.type, ast.Array): if len(element_type_opt) != 1: message.warn( - 'element-type annotation for an array must have exactly ' + '"element-type" annotation for an array must have exactly ' 'one option, not %d options' % (len(element_type_opt), ), annotations.position) return node.type.element_type = self._resolve(element_type_opt[0], node.type, node, parent) else: - message.warn_node(parent, - "Unknown container %r for element-type annotation" % (node.type, )) + message.warn( + "Unknown container %r for element-type annotation" % (node.type, ), + annotations.position) def _get_transfer_default_param(self, parent, node): if node.direction in [ast.PARAM_DIRECTION_INOUT, |