// If this object is an element of a list, this method with replace it with another value public void CopyFrom(eeObject fromObj, bool asArrayElement = false) { switch (fromObj.type) { case eeObjectType.NUMBER: this.value = fromObj.AsNumber().Copy(); break; default: // all other types are natively constants so we dont need to explicity copy them this.value = fromObj.value; break; } this.attributes = fromObj.attributes; this.methods = fromObj.methods; this.type = fromObj.type; // Array elements do not get modifiers if (asArrayElement) { modifier = null; } }
public static string ObjectTypeToString(eeObjectType type) { switch (type) { case eeObjectType.BOOL: return("BOOLEAN"); case eeObjectType.FUNCTION: return("FUNCTION"); case eeObjectType.LIST: return("LIST"); case eeObjectType.NUMBER: return("NUMBER"); case eeObjectType.STRING: return("STRING"); default: return("<internal type>"); } }
public NoMethodError(string methodName, eeObjectType objType) : base("NoMethodError", $"Method with name '{methodName}' does not exist for object of type {ObjectTypeHelpers.ObjectTypeToString(objType)}") { }
public NegationError(eeObjectType type, bool not = false) : base("NegationError", $"Cannot negate object {(not ? "that is not" : "")} of type {ObjectTypeHelpers.ObjectTypeToString(type)}.") { }