|
There were several problems with the model of literals:
* LiteralNumber had radix which is not applicable for floats
* All LiteralValue used an inherited Object attribute which makes it
difficult/impossible to correctly serialize literal values.
The refactoring moves the value attribute to each subclass, adds
LiteralInteger (with radix), and LiteralFloat as subclasses of
LiteralNumber.
LiteralRegexp required special handling since a regular expression
must be serialized as a String. Now LiteralRegularExpression has two
attributes 'pattern' (string), and 'value' (regexp). Setting either
changes the other. When serialized, only the pattern is serialized (and
the regexp value is reconstructed on de-serialization).
|