What steps will reproduce the problem? 1. Create an anonymous function within a defined class function
var fun : Function;
private function doStuff(do : Boolean) { if(do) { fun = function(test) : void { trace("foo bar"); } fun(); } } 2. When calling the 'fun()' function, the trace is definitely executed 3. Code Coverage report shows that the anonymous function was NEVER hit.
What is the expected output? What do you see instead? I would expect the coverage tool to show a 100% hit of this method
What version of the product are you using? On what operating system? Version 0.8 MacOSX or Windows Vista / Windows 7
Please provide any additional information below.
Comment #1
Posted on Sep 27, 2010 by Happy HorseAttached is a patch file that addresses the problem through the CoverageViewer.
It seems the compiler generated CVM wasn't matching up with the linker generated information. The compiler was generating "_anonymous$x" named functions for the CVM where "x" was an integer that was incremented per anonymous function across the entire compilation. When it got to the linker, the "x" value was being incremented once per class, so all anonymous functions in a given class were using the same value. So the info coming over the connection wasn't matching up with what it loaded from the CVM.
Within the CoverageElement which is used during the loading of the CVM, I'm remapping the function names based on this behavior.
One thing this may not handle is multiple CVM files loaded into a CoverageViewer. I'd bet the counter I'm using needs to be reset for each CVM load, but I don't have a scenario to confirm/test this.
- FlexCover_Issue41.patch 2.91KB
Comment #2
Posted on Oct 1, 2010 by Swift WombatAny chance we could get this patch included in the next release of the coverage viewer?
Status: New
Labels:
Type-Defect
Priority-Medium