Nesting withExtDeclHandler
Benedikt Huber
benedikt.huber at gmail.com
Mon Jul 20 10:06:00 EDT 2009
Hi Denis,
I think this is a bug, added to the trac:
http://www.sivity.net/projects/language.c/ticket/33
Would you like to try the patch attached to that page ?
thanks, benedikt
Bueno, Denis wrote:
> Hi all,
>
> While trying to do some analysis with the TravMonad I wrote some code that
> looked like so:
>
> withExtDeclHandler (analyseAST cTranslUnit) handleFun
>
> handleFun (DeclEvent (FunctionDef (FunDef varDecl bodyStat info)) =
> modifyUserState update
> withExtDeclHandler (analyseFunctionBody info varDecl bodyStat)
> recordLocalEvents
> return ()
>
> recordLocalEvents (LocalEvent ...) =
> modifyUserState recordEvent
>
> That is, I was doing a pass over the entire AST with one external DeclEvent
> handler, and I wanted to temporarily override that handler locally to
> process the local declarations of a FunDef. After finishing the FunDef, I
> wanted to resume the main analysis with the original handler (`handleFun').
>
> This didn't work out as planned; debugging revealed that after the second
> handler (`recordLocalEvents') is invoked the first time, the first handler
> never gets invoked again on the rest of the AST.
>
> Running the same analysis on the same C code with just one external handler
> invokes all the events I expected.
>
> Is this intended behavior? Is there a simple workaround so that I can use
> two handlers? I've come up with a way to do what I want using only one
> handler, but it's not a simple as I'd like.
> Denis
>
>
>
> _______________________________________________
> Language-c mailing list
> Language-c at projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/language-c
>
More information about the Language-c
mailing list