mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
gh-90110: Update the c-analyzer Tool (gh-96058)
This commit is contained in:
parent
5aac85101b
commit
586fc02be5
4 changed files with 87 additions and 8 deletions
|
|
@ -385,6 +385,9 @@ def get_parsed_vartype(decl):
|
|||
elif isinstance(decl, Variable):
|
||||
storage = decl.storage
|
||||
typequal, typespec, abstract = decl.vartype
|
||||
elif isinstance(decl, Signature):
|
||||
storage = None
|
||||
typequal, typespec, abstract = decl.returntype
|
||||
elif isinstance(decl, Function):
|
||||
storage = decl.storage
|
||||
typequal, typespec, abstract = decl.signature.returntype
|
||||
|
|
@ -1012,6 +1015,18 @@ class Signature(namedtuple('Signature', 'params returntype inline isforward')):
|
|||
def returns(self):
|
||||
return self.returntype
|
||||
|
||||
@property
|
||||
def typequal(self):
|
||||
return self.returntype.typequal
|
||||
|
||||
@property
|
||||
def typespec(self):
|
||||
return self.returntype.typespec
|
||||
|
||||
@property
|
||||
def abstract(self):
|
||||
return self.returntype.abstract
|
||||
|
||||
|
||||
class Function(Declaration):
|
||||
kind = KIND.FUNCTION
|
||||
|
|
@ -1106,9 +1121,16 @@ class TypeDef(TypeDeclaration):
|
|||
def _resolve_data(cls, data):
|
||||
if not data:
|
||||
raise NotImplementedError(data)
|
||||
vartype = dict(data)
|
||||
del vartype['storage']
|
||||
return VarType(**vartype), None
|
||||
kwargs = dict(data)
|
||||
del kwargs['storage']
|
||||
if 'returntype' in kwargs:
|
||||
vartype = kwargs['returntype']
|
||||
del vartype['storage']
|
||||
kwargs['returntype'] = VarType(**vartype)
|
||||
datacls = Signature
|
||||
else:
|
||||
datacls = VarType
|
||||
return datacls(**kwargs), None
|
||||
|
||||
@classmethod
|
||||
def _raw_data(self, data):
|
||||
|
|
|
|||
|
|
@ -9,7 +9,11 @@ from ._regexes import (
|
|||
|
||||
def log_match(group, m):
|
||||
from . import _logger
|
||||
_logger.debug(f'matched <{group}> ({m.group(0)})')
|
||||
text = m.group(0)
|
||||
if text.startswith(('(', ')')) or text.endswith(('(', ')')):
|
||||
_logger.debug(f'matched <{group}> ({text!r})')
|
||||
else:
|
||||
_logger.debug(f'matched <{group}> ({text})')
|
||||
|
||||
|
||||
#############################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue