diff options
author | Mikko Lehtonen <scoopr@iki.fi> | 2018-11-13 00:03:30 +0200 |
---|---|---|
committer | Mikko Lehtonen <scoopr@iki.fi> | 2018-11-13 22:25:40 +0200 |
commit | d5883c677d0ffc57ec38e8483428d9ab8b516623 (patch) | |
tree | d774d2db11d15f4663a537ad4eb5e66fc8f7cf55 /src | |
parent | d5dac094954b017468866129ed502655476d92ef (diff) |
Fix namespaces with macro names
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/context.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/ir/context.rs b/src/ir/context.rs index bdf38428..c0f92464 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -2160,16 +2160,21 @@ If you encounter an error missing from this list, please file an issue or a PR!" ::clang_sys::CXCursor_Namespace, "Be a nice person" ); + + let mut module_name = None; + let spelling = cursor.spelling(); + if !spelling.is_empty() + { + module_name = Some(spelling) + } + let tokens = match cursor.tokens() { Some(tokens) => tokens, - None => return (None, ModuleKind::Normal), + None => return (module_name, ModuleKind::Normal), }; - let mut iter = tokens.iter(); let mut kind = ModuleKind::Normal; let mut found_namespace_keyword = false; - let mut module_name = None; - while let Some(token) = iter.next() { match &*token.spelling { "inline" => { @@ -2195,7 +2200,9 @@ If you encounter an error missing from this list, please file an issue or a PR!" break; } name if found_namespace_keyword => { - module_name = Some(name.to_owned()); + if module_name.is_none() { + module_name = Some(name.to_owned()); + } break; } _ => { |