Workaround for cfscript bug in varscoper

Those that use the sensational varscoper tool from Mike Schierberl know that cfscript is still a little experimental with the current release.

One of the things it can do is return variables that are actually “var” scoped as not var scoped when using cfscript. This seems to happen most often when you have a comment directly above the variable in question.

<cfscript>

	var column = 2;		//which column the pod is in
	var row = 3;		//which row the pod is on
	var newRow = 0;

</cfscript>

In the above example Varscoper tells me that “newRow” is not var scoped when clearly it is.

This is usually fine, but if you start to get a lot of these false positives there is a quick little workaround. Place a semi-colon at the end of the last comment which effectively tells varscoper where the statement finishes and fixes the problem.

<cfscript>

	var column = 2;		//which column the pod is in
	var row = 3;		//which row the pod is on;
	var newRow = 0;

</cfscript>

Note the semi-colon after the 2nd comment. Now my reports are nice and clean :)

Post a Comment or Leave a Trackback

4 Comments

  1. April 8, 2008 at 4:45 am | Permalink

    Nice one. Thanks.

  2. April 9, 2008 at 3:00 pm | Permalink

    Do you mind posting an issue at RIAforge? I have a few other open ones there. Someday I’ll get around to them all, and I want to make sure I don’t miss this.

    -Mike

  3. May 21, 2008 at 6:24 am | Permalink

    OK, today is the day, the issue should be fixed in 1.20, I’ve posted the new version up on RIAForge.

  4. May 21, 2008 at 10:00 am | Permalink

    @Mike – thanks for that, I’ll check it out. Thanks again for a fantastic tool!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*