AS3, something is wrong with "create method" generator...


I am trying to use method generator, but it looks like it is buggy.

If I use generator like this:

2014-07-02 14_44_04-starlingObjectSimplified - [E__!workspaceArchive_starlingObjectSimplified] - [st.png

I end up with errorous code:

2014-07-02 14_44_20-starlingObjectSimplified - [E__!workspaceArchive_starlingObjectSimplified] - [st.png

is there a way to fix it?

thanks for your time.

Comment actions Permalink

IntelliJ IDEA quick fixes (like this 'create method') are designed to create declaration from usage. In your case 'init' is not a usage because it is not placed inside the other function where method can actually be called. So the bug here is that 'Create method init' quick fix is suggested, in fact no quick fixes should be available in this context.
There are 2 ways for you to work with it:
- write init() inside a function, e.g. in TestObj constructor body and invoke quick fix
- instead of using quick fix use live template to create a function: type 'pf' and press Tab - that's a predefined live template for public function

Comment actions Permalink


I used another tool before that was able to detect that it is generated from main body, or from another function, and change its begaviour, so I was missing same behaviour in Intellij.

Option 2 sounds good enough.



Please sign in to leave a comment.