private RuntimeResult TypeDefAssign(Values.ValueType type, Values.Value from, string name, Position position, Context context) { if (from.Type == type) { context.AddSymbol(name, from); return(new RuntimeResult(from)); } Values.Value castedVal = from.Cast(type); castedVal.TypeDefined = true; if (castedVal == null) { return(new RuntimeResult(new RuntimeError(position, "Can't convert '" + from.Type.ToString().ToLower() + "' to '" + type.ToString().ToLower() + "'", context))); } context.AddSymbol(name, castedVal); return(new RuntimeResult(castedVal)); }