Re: [pygccxml-development] mdecl and methods that return values
Brought to you by:
mbaas,
roman_yakovenko
From: Allen B. <al...@vr...> - 2006-05-30 15:01:52
|
Roman Yakovenko wrote: > On 5/30/06, Allen Bierbaum <al...@vr...> wrote: > >> I just ran into an interesting limitation on the current API. >> >> Namely, when you call methods on mdecl_wrappers and those methods return >> decls for further processing, the return values are ignored. >> >> I ran into in the following case: >> >> my_class = my_namespace["MyClass"] >> my_class["mymethod"].exclude() > > > exclude does not have return value The part that causes the problem is the return from ["mymethod"]. It doesn't return anything, so the code above ends up calling exclude() on NoneType. > >> It could also come up in something else like this though: >> >> similar_classes = my_namespace.classes(re_matcher(".*Proxies")) >> similar_classes.member_functions["bad_function"].exclude() >> >> The point is that that the call_redirector_t for mdecl_wrapper doesn't >> return any values from the methods it calls. >> >> I propose that we refactor this method to build up a list of decls >> returned from all the calls it makes and return them wrapped as a >> mdecl_wrapper_t if there are values returned and if they make sense to >> combine (ie. if they are all decl wrappers). This should allow >> functionality like above and would add quite a bit of flexibility to >> finding groups of matches within other groups of matches. (ex: find >> groups of similar methods inside groups of similar classes) > > >> Any comments? > > > Allen, I am sorry but I don't understand you. Do you want to know what > declarations > has been [in|ex]cluded? No. I want to be able to call methods like decls(), member_functions(), classes(), etc on an mdecl_wrapper and have it return another mdecl_wrapper. Right now these would be called but the return values would be silently ignored. > Or you want something more general: to define > return values > for mdecl_wrapper_t for "get" and "call" functionality, as a list of > returned values? I don't know the answer to this one. I am interested in getting feedback on how other people think this code should function. > > Also, can you modify mdec_wrapper.py file and send it? Maybe. I am not sure if I understand everything going on in there so I didn't want to take a stab at it and implement it incorrectly. -Allen > > Thanks > > |