View unanswered posts | View active topics



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

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
ir73 wrote:
Philippe wrote:
Convention for consts is:
Code:
static public const SOME_CONST:String = "someConst";

ok, so that was the reason you did not include that? I can make a fix if you want.

Mmm no, is that in your ascomplete.patch?


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

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
yes, it is. See GeneratorJobType.Contant in ASGenerate class. Also check ShowNewClassList method, it fixes the problem when you have that code
new SomeClass();
and it offers only creating a new function, not class.


Fri Jul 30, 2010 12:59 pm
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Strange I think I applied your patch completely. Can you create a new patch with the missing feature?


Fri Jul 30, 2010 1:38 pm
Profile WWW
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
wow, now I see that's the problem. You have taken some very old version of patch (maybe 1 month old). Can you rollback the changes and apply the patch again given in first post?


Fri Jul 30, 2010 2:06 pm
Profile
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
Ok, there's no need to rollback. I have created a new patch that makes all the necessary changes with the latest trunk. Japanese keys are also added.

http://dl.dropbox.com/u/9443658/fd/asgenerator2.patch


Fri Jul 30, 2010 2:14 pm
Profile
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
ir73 wrote:
Ok, there's no need to rollback. I have created a new patch that makes all the necessary changes with the latest trunk. Japanese keys are also added.

http://dl.dropbox.com/u/9443658/fd/asgenerator2.patch


I have now added "Generate Constructor" and "Generate toString()" to Ctrl+Shift+1
http://dl.dropbox.com/u/9443658/fd/asgenerator2.patch

Image

Image


Mon Aug 02, 2010 9:21 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
Patch applied. Cool stuff :)

One change I made: since you are adding generator patterns that people may not have (if they keep an old generator.txt file) I added a way to provide a default template.


Mon Aug 02, 2010 1:51 pm
Profile WWW
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
Sweet! I have now updated that patch viewtopic.php?f=19&t=6985 to match the latest trunk so it would be easy to integrate that one too :)


Mon Aug 02, 2010 3:04 pm
Profile
Member

Joined: Sat Oct 17, 2009 11:37 pm
Posts: 13
Reply with quote
Just tested this feature with haxe, but it seems that it's not really compatible. I found out the following issues:

my code (same file):
Code:
class Foo {
   public function new () {}
}

class Test {
   
   static function main() {
      
      var f:Foo = new Foo();
      f.doIt();
      
   }
}


CTRL+SHIFT+1 -> Generate public function

creates the following code:

Code:
class Foo {
   public function new () {}
}

class Test {
   
   static function main() {
      
      var f:Foo = new Foo();
      f.doIt();
      
   }
   
   static public function doIt():Void
   {
      
   }
}


but should create this code:
Code:
class Foo {
   public function new () {}
       
        public function doIt():Void
   {
      
   }
}

class Test {
   
   static function main() {
      
      var f:Foo = new Foo();
      f.doIt();
      
   }
}


best,
h


Sun Aug 15, 2010 11:26 am
Profile
Member

Joined: Sat Oct 17, 2009 11:37 pm
Posts: 13
Reply with quote
And if Foo is in another File it generates the following code

File Test.hx
Code:
class Test{
   
   static function main() {
      
      var f:Foo = new Foo();
      f.doIt();
      
   }
}


File Foo.hx
Code:
class Foo {
   public function new () {}
   
}


Foo.hx after CTRL+SHIFT+1 -> Generate public function
Code:
class Foo {
   public function new () {}
   
   static public function doIt():Void
   {
      
   }
}


but should be:
Code:
class Foo {
   public function new () {}
   
   public function doIt():Void
   {
      
   }
}


best,
h


Sun Aug 15, 2010 11:32 am
Profile
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
...........


Mon Aug 16, 2010 7:26 am
Profile
Member

Joined: Sun Aug 19, 2007 4:56 pm
Posts: 210
Location: Germany (TEMP)
Reply with quote
Hello,

is it possible to alter code format of how toString() generator functions?

I like this format :
Code:
   public function toString():String {
      return "DailyQuestData{isActive:" + isActive + ", endTimeStamp:" + endTimeStamp + ", isDone:" + isDone + ", tasks:" + tasks + ", reward:" + reward + "}";
   }


its more readable to me.

plus... I put vectors(or arrays.. I don't remember than I last used those in code...) in "[]"

Code:
        return "DailyQuestData{isActive:" + isActive + ", endTimeStamp:" + endTimeStamp + ", isDone:" + isDone + ", tasks:[" + tasks + "], reward:" + reward + "}";

but that most likely dificult to implement...

oh.. and I format it like this :

Code:
   public function toString():String {
      return "DailyQuestData{" +
         "isActive:" + isActive +
         ", endTimeStamp:" + endTimeStamp +
         ", isDone:" + isDone +
         ", tasks:[" + tasks + "]" +
         ", reward:" + reward +
         "}";
   }


fore easier maintainability.. ;)

Thanks for great patch.


Last edited by Deril on Sun Oct 31, 2010 2:37 am, edited 1 time in total.



Wed Oct 13, 2010 9:09 am
Profile WWW
Member

Joined: Thu Mar 29, 2007 9:32 am
Posts: 244
Reply with quote
My next plan is to make templates to as much generators as possible


Wed Oct 13, 2010 11:13 am
Profile
Member

Joined: Wed Apr 29, 2009 12:05 pm
Posts: 225
Reply with quote
Was the toString template generator made in the end?


Fri Oct 21, 2011 9:14 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
WORMSS wrote:
Was the toString template generator made in the end?

yes, just go outside a function in the class and press Ctrl+Shift+1


Sat Oct 22, 2011 9:59 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 52 posts ]  Go to page Previous  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:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.