Export to GitHub

maashaack - issue #205

improve dump functions in core


Posted on May 13, 2013 by Happy Monkey

in case where the class/object to dump is a native class in the FPAPI most of the time the instance resolve to "Object" and return an empty "{ }"

for ex:

var r:Rectangle = new Rectangle( 0, 0, 20, 20 );

trace( dump( r ) ); //output: "{ }"

it would be nice in those cases to be able to add custom toSource serializer

for ex: var toSourceRectangle = function( r:Rectangle ):String { var args:Array = [ r.x, r.y, r.width, r.height ]; return "new Rectangle( " + args.join(", " ) + " );"; }

Comment #1

Posted on May 13, 2013 by Happy Monkey

even better, let's use a bit of reflection fun ;)

for ex:

var r:Rectangle = new Rectangle( 0, 1, 2, 3 );

var _class:XML = describeType( Rectangle );

...

var _class:XML = describeType( r );

...

eg. we can find out the class name, the number of args in the ctor, if they are optional or not, etc.

Status: Accepted

Labels:
Type-Enhancement Priority-Medium