Commit a0bc8b71 authored by twanvl's avatar twanvl

to_code(nil)=="nil", to_color(nil)==rgba(0,0,0,0)

parent 932dcf39
...@@ -350,12 +350,19 @@ class ScriptNil : public ScriptValue { ...@@ -350,12 +350,19 @@ class ScriptNil : public ScriptValue {
virtual ScriptType type() const { return SCRIPT_NIL; } virtual ScriptType type() const { return SCRIPT_NIL; }
virtual String typeName() const { return _TYPE_("nil"); } virtual String typeName() const { return _TYPE_("nil"); }
virtual String toString() const { return wxEmptyString; } virtual String toString() const { return wxEmptyString; }
virtual String toCode() const { return _("nil"); }
virtual double toDouble() const { return 0.0; } virtual double toDouble() const { return 0.0; }
virtual int toInt() const { return 0; } virtual int toInt() const { return 0; }
virtual bool toBool() const { return false; } virtual bool toBool() const { return false; }
virtual AColor toColor() const { return AColor(0,0,0,0); }
virtual GeneratedImageP toImage() const { virtual GeneratedImageP toImage() const {
return intrusive(new BlankImage()); return intrusive(new BlankImage());
} }
virtual CompareWhat compareAs(String& compare_str, void const*&) const {
// TODO: do we want both nil=="" and nil==0? Then we would get non-transitive equality
compare_str.clear();
return COMPARE_AS_STRING;
}
protected: protected:
virtual ScriptValueP do_eval(Context& ctx, bool) const { virtual ScriptValueP do_eval(Context& ctx, bool) const {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment