public EVariable Convert(ETypeWord to) { EVariable tryConvert = ConvertInternal(to); if (tryConvert != null) { return(tryConvert); } if (GetEType().Get() == to.Get()) { return(this); } return(CannotConvert(to)); }
protected override EVariable ConvertInternal(ETypeWord to) { switch (to.Get()) { case EType.Double: return(((EVDouble)New(to)).Set(value)); case EType.Int: return(((EVInt)New(to)).Set(value)); case EType.Boolean: return(((EVBoolean)New(to)).Set(value != 0)); } return(null); }
public static EVariable New(ETypeWord type) { return(New(type.Get())); }