cppcheckdata: Set Function.nestedIn attribute

This commit is contained in:
Daniel Marjamäki 2020-04-16 12:14:29 +02:00
parent e4bea02cad
commit 75a369d217
1 changed files with 4 additions and 2 deletions

View File

@ -392,8 +392,9 @@ class Function:
isVirtual = None isVirtual = None
isImplicitlyVirtual = None isImplicitlyVirtual = None
isStatic = None isStatic = None
nestedIn = None
def __init__(self, element): def __init__(self, element, nestedIn):
self.Id = element.get('id') self.Id = element.get('id')
self.tokenDefId = element.get('tokenDef') self.tokenDefId = element.get('tokenDef')
self.name = element.get('name') self.name = element.get('name')
@ -404,6 +405,7 @@ class Function:
self.isImplicitlyVirtual = (isImplicitlyVirtual and isImplicitlyVirtual == 'true') self.isImplicitlyVirtual = (isImplicitlyVirtual and isImplicitlyVirtual == 'true')
isStatic = element.get('isStatic') isStatic = element.get('isStatic')
self.isStatic = (isStatic and isStatic == 'true') self.isStatic = (isStatic and isStatic == 'true')
self.nestedIn = nestedIn
self.argument = {} self.argument = {}
self.argumentId = {} self.argumentId = {}
@ -940,7 +942,7 @@ class CppcheckData:
continue continue
elif node.tag == 'function': elif node.tag == 'function':
if event == 'start': if event == 'start':
cfg_function = Function(node) cfg_function = Function(node, cfg.scopes[-1])
continue continue
elif event == 'end': elif event == 'end':
cfg.functions.append(cfg_function) cfg.functions.append(cfg_function)