Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Just add -inline to the asc2 arguments to see this break.
- //
- // A decompiler reveals the bug.
- public static function getNameByKey(value:int):string{ var _local2 = value; while (_local2._key === (_local2 = StaticMember)) { return ("It works as expected"); }; return (("Broken: " + value)); }
- package
- {
- import flash.display.Sprite;
- import flash.text.TextField;
- import flash.text.TextFieldAutoSize;
- public final class Application extends Sprite
- {
- public function Application()
- {
- const textField: TextField = new TextField();
- textField.autoSize = TextFieldAutoSize.LEFT;
- textField.text = IssuedClass.StaticMember.toString();
- addChild( textField );
- }
- }
- }
- package
- {
- public final class IssuedClass
- {
- public static const StaticMember: IssuedClass = new IssuedClass( 1 );
- public static function getNameByKey( value: int ): String
- {
- // There are at least 2 workarounds.
- // A Comment in the next line
- // StaticMember.key;
- // B access private member StaticMember._key directly in case statement
- switch( value )
- {
- case StaticMember.key:
- return 'It works as expected';
- }
- return 'Broken: ' + value; // this should never happen! Most of weirdness: value is one!
- }
- private var _key: int;
- public function IssuedClass( key: int )
- {
- _key = key;
- }
- public function get key(): int
- {
- return _key;
- }
- public function toString(): String
- {
- return '[IssuedClass key: ' + getNameByKey( _key ) + ']';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement