You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Q: I have a case where I have one line in a method and need to insert say 5-6 lines replacing it.
When I do it using visitMethodDecl I get the error that expected a template which will replace 1 statement with 1 but created 6 ..What is the workaround for it ?
one option is to return a block of statements { a; b; c; }.. and then call RemoveUnneededBlock right after
it's a creative way to solve this that I've used in the past as well.. works well enough for the code you already have most likely
the other option is to look up to the block that the variable declaration that you have is defined within, and replace the statements within that block with a new or mapped collection
both of those end up with the same result: your variable declaration replaced by multiple statements, but each only replacing one element of the LST with another
@timtebeek When you have time, would you mind assisting with examples here?
Specifically:
I am not sure when you'd use the different cursor options (getCursor, updateCursor, new Cursor).
For these, it would be swell to have an example with them.
I'd love an example of some code that returns a block of statements and then calls the remove unneeded block to have some context as to why someone might do that.
Once I have some examples and more context, I'm happy to update the doc accordingly. ^_^
From Slack:
Answer: Read this thread
From Tim:
To help, we should expand on
getCursor
,updateCursor
, andnew Cursor
as well as provide examples.The text was updated successfully, but these errors were encountered: