================
@@ -29,6 +29,19 @@ STRING_EXTENSION_OUTSIDE(SBValue)
'''An accessor function that returns a children_access() object
which allows lazy member variable access from a lldb.SBValue object.'''
return self.children_access (self)
+ def get_member_access_object(self):
+ '''An accessor function that returns an interface which provides
subscript based lookup of child members.'''
+ class member_access:
+ def __init__(self, valobj):
+ self.valobj = valobj
+
+ def __getitem__(self, key):
+ if isinstance(key, str):
+ return self.valobj.GetChildMemberWithName(key)
+ raise TypeError("invalid subscript key")
----------------
kastiglione wrote:
I changed it to `member key must be a string`. Since the error is only raised
when the key is not a string (a dynamic type check), I left out the semantic
part of your suggested message.
https://github.com/llvm/llvm-project/pull/118814
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits