summaryrefslogtreecommitdiff
path: root/giscanner/ast.py
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2010-09-07 19:36:58 -0400
committerOwen W. Taylor <otaylor@fishsoup.net>2010-09-07 20:03:59 -0400
commitda89c092c5bac56524bd2b60c0f261b9fa3b91be (patch)
tree323ea9fd72a99b8ec13b514658f3d8987252097f /giscanner/ast.py
parentcd0de25d5971a34f49830668337af96b15fed4b4 (diff)
downloadgobject-introspection-da89c092c5bac56524bd2b60c0f261b9fa3b91be.tar.gz
Handle casing better for constants
Instead of handling constants by lower-casing them, stripping the lower-case prefix and upper-casing them again, leave them in the original case and check against upper-cased versions of namespace.symbol_prefixes. Wwe detect what version to test against by looking at the first character of the identifier, so we assume that --symbol-prefix options are always in lowercase. If that needs to be relaxed, then we'll have to check all symbols against both sets of prefixes. Add tests for constants to Regress.h and fix tests/warn/unresolved-type.h for a warning message that improved with this change. https://bugzilla.gnome.org/show_bug.cgi?id=629007
Diffstat (limited to 'giscanner/ast.py')
-rw-r--r--giscanner/ast.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py
index b03d43f9..ada6412d 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -311,6 +311,8 @@ class Namespace(object):
else:
ps = self.identifier_prefixes
self.symbol_prefixes = [to_underscores(p).lower() for p in ps]
+ # cache upper-cased versions
+ self._ucase_symbol_prefixes = [p.upper() for p in self.symbol_prefixes]
self._names = odict() # Maps from GIName -> node
self._aliases = {} # Maps from GIName -> GIName
self._type_names = {} # Maps from GTName -> node