--- Calls the transform function on this argument.
-- The return value(s) from this function are passed to all of the other argument methods.
-- Called automatically at instantiation

function Argument:Transform()
	if #self.TransformedValues ~= 0 then
		return
	end

	if self.Type.Listable and #self.RawValue > 0 then
		local rawSegments = Util.SplitStringSimple(self.RawValue, ",")

		if self.RawValue:sub(#self.RawValue, #self.RawValue) == "," then
			rawSegments[#rawSegments + 1] = "" -- makes auto complete tick over right after pressing ,
		end

		for i, rawSegment in ipairs(rawSegments) do
			self.RawSegments[i] = rawSegment
			self.TransformedValues[i] = { self:TransformSegment(rawSegment) }
		end
	else
		self.RawSegments[1] = self.RawValue
		self.TransformedValues[1] = { self:TransformSegment(self.RawValue) }
	end
end

function Argument:TransformSegment(rawSegment)
	if self.Type.Transform then
		return self.Type.Transform(rawSegment, self.Executor)
	else
		return rawSegment
	end
end
