View unanswered posts | View active topics



Reply to topic  [ 52 posts ]  Go to page 1, 2, 3, 4  Next
Methods and variables generation patch 
Author Message
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
Here's an improved methods and variables generation patch that is described here viewtopic.php?f=4&t=6743 . I decided to post it into this thread because I am fixing bugs and making improvements from time to time so I will update it periodically (unless included into trunk :).

Features:
* Interfaces support
* Parameter types detection support
* private and public methods (variables) generation support
* automatic imports of parameter types
* Method (variable) will be generated inside a class where you are expecting it. E.g. structure
Code:
book.callNonExistantMethod(phone, glass);

will result the following method INSIDE Book class (and imports):
Code:
public function callNonExistantMethod(phone:PhoneVO, glass:GlassVO):void {
   
}

* Different formatting supported (will work with the following structure):
Code:
phone.
             nonExistantMehod(
                             book.name, book.pages);


Patch:
http://dl.dropbox.com/u/9443658/ascomplete.patch

Image
Image


Last edited by ir73 on Mon Jul 26, 2010 3:17 pm, edited 12 times in total.



Fri Jun 18, 2010 8:35 am
Profile
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
Reply with quote
Could you provide link to downloadable patch file? I cant apply it because stupid "Unknown line type" error occurred. (I use tortoise SVN).


Fri Jun 18, 2010 11:45 am
Profile WWW
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
http://www.4shared.com/file/l9sirUHF/ascomplete.html

you should have the latest flash develop content from svn trunk


Fri Jun 18, 2010 12:42 pm
Profile
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
Reply with quote
Thanks, It seems pretty good. I'll try to continue using the patch for testing reason. I think this patch is usable and should be implemented in FD as soon as possible.


Fri Jun 18, 2010 1:17 pm
Profile WWW
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
updated today (some bugfixes). See link in first post


Tue Jun 29, 2010 2:29 pm
Profile
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
Reply with quote
Generated methods for another class was inserting in incorrect position (into the body of the existing method), so I reverted from previous patch. Does it fixed now?


Tue Jun 29, 2010 6:24 pm
Profile WWW
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
yes, that should be fine now. This happened if another class was already open in flash develop. Please use patch from first post.


Tue Jun 29, 2010 7:43 pm
Profile
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
btw, do not wait until I find all kind of bugs myself, feel free to post 'em here. I will be glad to fix them.


Tue Jun 29, 2010 7:47 pm
Profile
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
Reply with quote
Ok, I have applied patch again and have one suggestion:

generate return type for function, when possible.
For example:

from code

var damagePoints:Array = getDamagePoints();

generate

private function getDamagePoints():Array
{

}


Wed Jun 30, 2010 12:05 pm
Profile WWW
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
Reply with quote
And one more suggestion: handle if generated function should be static.


Wed Jun 30, 2010 1:23 pm
Profile WWW
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
Canab wrote:
And one more suggestion: handle if generated function should be static.

done (check link in first post)

Also now new members (variables and functions) are generated in correct place from visibility point of view: public functions near public functions, private - near private. It's good when you store public functions in one section of your class and private in another.


Wed Jun 30, 2010 2:55 pm
Profile
Member

Joined: Mon Oct 16, 2006 12:02 am
Posts: 337
Location: Lviv, Ukraine
Reply with quote
It works pretty fine now.
I am happy with generating functions with correct argument list and properly imported necessary types.
But it seems a little bit overfeatured with public/private qualifiers for me.
I'll try to explain. When I need to generate member outside (in another class) it suggests me to generate public member. It is correct, because other cases haven't sense in this context :). In another case, when I need to generate member in the same class, it proposes:
private var
public var
private func
public func
class


I don't remember when I need to generate public members in this context. (protected qualifier also exists)
It would be better for me to have generation for private members only inside class. It is not hard to switch private qualifier into public/protected (by snippet or duplicate plugin).
Maybe I am not right and others could need such approach.

And one more suggestion (sorry for offtopic/advertising): 4shared.com is little annoying with 20 seconds delay.
Dropbox (https://www.dropbox.com/referrals/NTE2NzQ0MzU5) is quite good service for file sharing/backup.
Its free (2...8 GB of data), gives direct links and integrates in local file system.


Fri Jul 02, 2010 12:30 pm
Profile WWW
Member

Joined: Sat Nov 15, 2008 4:00 am
Posts: 171
Reply with quote
WOW! Its cool, I've waiting for this features very long time in FD :)

Just one request for improvements:

for example we have event class SomeEvent, and if somewhere we wrote
Code:
dispatchEvent( new SomeEvent(SomeEvent.NEW_EVENT_TYPE< here Press Ctrl+Shift+1 > ....

or
Code:
addEventListener(SomeEvent.NEW_EVENT_TYPE< here Press Ctrl+Shift+1 > ....

add in generation menu something like this "generate event type"
if we choose "generate event type" item in SomeEvent class generate this string
Code:
public static var NEW_EVENT_TYPE:String = "SomeEvent.NEW_EVENT_TYPE";


Thanks for very usable patch, it should be impemented in FD core :)


Fri Jul 02, 2010 2:22 pm
Profile
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
Kulkoff, here you are (link in first post)

Cheers


Fri Jul 02, 2010 3:02 pm
Profile
Member

Joined: Sat Nov 15, 2008 4:00 am
Posts: 171
Reply with quote
ir73 wrote:
Kulkoff, here you are (link in first post)

Cheers


Cool, but not right. Sometimes someone has a need to create not string variable and not only new event type in event classes.
So it sould be a new item and additional feature :)

Updated:

Oh, sorry, now I see you did all sings right :oops:


Fri Jul 02, 2010 4:32 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 52 posts ]  Go to page 1, 2, 3, 4  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.