after coding a custom event in AS3, I ran into a curious problem:
override public function toString():String
{
switch (type)
{
case CHANGE: return formatToString("HistoryEvent", "type", "action", "name", "data");
case ABILITY: return formatToString("HistoryEvent", "type", "undoable", "redoable");
}
}
the above code returns the following compile time error:
1170: the function does not return a value.
I can easily fix the problem by adding return null;functions at the end, but this is redundant, and it annoys me that this is the only solution.
why is the value returned from a switch case not seen by the compiler? is this a problem specific to the AS3 compiler, or am I really trying to do something here so completely dangerous and unfavorable that it obscures the countercultists around the world.
source
share