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 Members¶
| Constructors | none |
| Methods | __hash__(), __repr__(), __str__(), get_ast(), get_ordinal() |
ast_field_not_found_error Details¶
-
class
cs.ast_field_not_found_error¶ Describe an error where an
ast_fieldlookup 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_errorobject 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_errorobject.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
astin which the lookup was attempted.Return type: astReturns: The astthat 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_ordinalthat was requested.Return type: ast_ordinalReturns: The ast_ordinalthat 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>
-