Issue Details (XML | Word | Printable)

Key: FDT-1852
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: FDT Team
Reporter: Arjan van Wijk
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
FDT

formatte switch/case with curly braces {}

Created: 03/Mar/11 10:45 AM   Updated: 22/Jun/12 07:01 PM
Component/s: Formatter
Affects Version/s: FDT 4.2
Fix Version/s: FDT 4.3
Security Level: public

Time Tracking:
Not Specified


 Description  « Hide
There is a bug in the formatter when using curly braces {} for your case-blocks in a switch/case.
They should be optional and work the same as a 1-line for-loop or 1-line if-statement.
// correct
for (var i:int = 0; i < [].length; ++i)
{
	trace(i);
}

// correct
for (var i:int = 0; i < [].length; ++i)
	trace(i);

// correct
switch(i)
{
	case '1':
		trace(1);
		break;
	case '2':
		trace(1);
		break;
}

// wrong
switch(i)
{
	case '1':
		{
			trace(1);
			break;
		}
	case '2':
		{
			trace(1);
			break;
		}
}
// should be
switch(i)
{
	case '1':
	{
		trace(1);
		break;
	}
	case '2':
	{
		trace(1);
		break;
	}
}


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.