Merge pull request #9113 from jakobandersen/c_cpp_alias_fix

C, C++, alias fix
This commit is contained in:
Jakob Lykke Andersen 2021-04-18 17:02:59 +02:00 committed by GitHub
commit 9105635389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -24,6 +24,9 @@ Features added
Bugs fixed
----------
* C, C++, fix ``KeyError`` when an ``alias`` directive is the first C/C++
directive in a file with another C/C++ directive later.
Testing
--------

View File

@ -3454,7 +3454,8 @@ class AliasNode(nodes.Element):
if 'c:parent_symbol' not in env.temp_data:
root = env.domaindata['c']['root_symbol']
env.temp_data['c:parent_symbol'] = root
self.parentKey = env.temp_data['c:parent_symbol'].get_lookup_key()
env.ref_context['c:parent_key'] = root.get_lookup_key()
self.parentKey = env.ref_context['c:parent_key']
else:
assert parentKey is not None
self.parentKey = parentKey

View File

@ -7177,7 +7177,8 @@ class AliasNode(nodes.Element):
if 'cpp:parent_symbol' not in env.temp_data:
root = env.domaindata['cpp']['root_symbol']
env.temp_data['cpp:parent_symbol'] = root
self.parentKey = env.temp_data['cpp:parent_symbol'].get_lookup_key()
env.ref_context['cpp:parent_key'] = root.get_lookup_key()
self.parentKey = env.ref_context['cpp:parent_key']
else:
assert parentKey is not None
self.parentKey = parentKey