Given the following in the document class:
private function onAddedToStage(e:Event):void{
var userInfo:SomeClass = makeUserInfo("John", "Doe");
}
private function makeUserInfo(firstName:String, lastName:String, thirdly:Boolean=false):SomeClass{
var info:SomeClass = new SomeClass();
return info;
}
I get the following error:
verify TestJustUserInfoInstantiation/makeUserInfo()
stack:
scope: [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ TestJustUserInfoInstantiation$] ~
locals: TestJustUserInfoInstantiation String? String? Boolean *
0:getlocal0
stack: TestJustUserInfoInstantiation
scope: [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ TestJustUserInfoInstantiation$] ~
locals: TestJustUserInfoInstantiation String? String? Boolean *
1:pushscope
stack:
scope: [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ TestJustUserInfoInstantiation$] TestJustUserInfoInstantiation
locals: TestJustUserInfoInstantiation String? String? Boolean *
2:findpropstrict SomeClass
stack: global
scope: [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ TestJustUserInfoInstantiation$] TestJustUserInfoInstantiation
locals: TestJustUserInfoInstantiation String? String? Boolean *
4:constructprop 3 0
stack: SomeClass
scope: [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ TestJustUserInfoInstantiation$] TestJustUserInfoInstantiation
locals: TestJustUserInfoInstantiation String? String? Boolean *
7:coerce SomeClass
stack: SomeClass
scope: [global Object$ flash.events::EventDispatcher$ flash.display::DisplayObject$ flash.display::InteractiveObject$ flash.display::DisplayObjectContainer$ flash.display::Sprite$ TestJustUserInfoInstantiation$] TestJustUserInfoInstantiation
locals: TestJustUserInfoInstantiation String? String? Boolean *
9:dup
VerifyError: Error #1023: Stack overflow occurred.
at TestJustUserInfoInstantiation/onAddedToStage()
If I take out the third argument to the function, I don’t get the error.
If I set a property on info before returning it…
private function makeUserInfo(firstName:String, lastName:String, thirdly:Boolean=false):SomeClass{
var info:SomeClass = new SomeClass();
[COLOR=#ff0000] info.aProp = 7;[/COLOR]
return info;
}
… I don’t get the error. I know the code as I have it here doesn’t make a lot of sense, but I’ve just stripped it down to isolate the issue.
Can anyone explain what’s going on?