Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def to_decl_ext(d):
if isinstance(d, c_ast.TypeDecl):
return TypeDeclExt.from_pycparser(d)
elif isinstance(d, c_ast.ArrayDecl):
return ArrayDeclExt.from_pycparser(d)
else:
raise TypeError("unexpected decl type: %s" % type(d).__name__)
def from_pycparser(ad):
assert isinstance(ad, c_ast.ArrayDecl)
return ArrayDeclExt(ad.type, ad.dim, ad.dim_quals, ad.coord)