class ast_field_not_found_error

Describe an error where an ast_field lookup failed.

Will be thrown by ast.__getitem__() if the specified ordinal is not in the ast .

ast_field_not_found_error Details

class cs.ast_field_not_found_error

Describe an error where an ast_field lookup failed.

__hash__()

Get a hash value for a ast_field_not_found_error .

Return type:int
>>> try:
...     foosym = project.current().lookup_symbol('foo')
...     fooast = foosym.get_ast()
...     isvol = fooast[ast_ordinal.NC_ALIGNMENT]
... except ast_field_not_found_error as e:
...     print('string =', str(e))
...     print('hash =', hash(e))
...
string = cs.ast_ordinal alignment not found in <cs.ast [c:routine] foo>
hash = -345398784
__repr__()

Get a representation of a ast_field_not_found_error object that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> v0 = project.current()
>>> v1 = v0.compunits_vector()
>>> v2 = v1[0].get_ast()
>>> try:
...    v2[338]
... except ast_field_not_found_error as e:
...    v3 = e
...
>>> repr(v3)
'<cs.ast_field_not_found_error cs.ast_ordinal 338 not found in <cs.ast [c:file-info] >>'
__str__()

Get a simple string representation of a ast_field_not_found_error object.

Return type:str
Returns:The string representation.
>>> v0 = project.current()
>>> v1 = v0.compunits_vector()
>>> v2 = v1[0].get_ast()
>>> try:
...    v2[338]
... except ast_field_not_found_error as e:
...    v3 = e
...
>>> str(v3)
'cs.ast_ordinal 338 not found in <cs.ast [c:file-info] >'
get_ast()

Get the ast in which the lookup was attempted.

Return type:ast
Returns:The ast that did not have the requested ordinal.
>>> v0 = project.current()
>>> v1 = v0.compunits_vector()
>>> v2 = v1[0].get_ast()
>>> try:
...    v2[338]
... except ast_field_not_found_error as e:
...    v3 = e
...
>>> v3.get_ast()
<cs.ast [c:file-info] >
get_ordinal()

Get the ast_ordinal that was requested.

Return type:ast_ordinal
Returns:The ast_ordinal that that was requested.
>>> v0 = project.current()
>>> v1 = v0.compunits_vector()
>>> v2 = v1[0].get_ast()
>>> try:
...    v2[338]
... except ast_field_not_found_error as e:
...    v3 = e
...
>>> v3.get_ordinal()
<cs.ast_ordinal 338>