2,875
edits
No edit summary |
No edit summary |
||
Line 73: | Line 73: | ||
if self.state == 0 then | if self.state == 0 then | ||
self.state = 1 | self.state = 1 | ||
self.index = self.isArray and 0 or nil | |||
end | end | ||
Line 98: | Line 99: | ||
-- they just call moveNext on the enumerator instead. | -- they just call moveNext on the enumerator instead. | ||
function TableEnumerator:getEnumerator(isArray) | function TableEnumerator:getEnumerator(isArray) | ||
local instance = (self.state == 0) and self or TableEnumerator.new(self.tbl) | |||
instance.isArray = isArray | |||
return instance | |||
end | end | ||
Line 145: | Line 141: | ||
end | end | ||
function SelectEnumerator:getEnumerator() | function SelectEnumerator:getEnumerator(isArray) | ||
local instance = (self.state == 0) and self or SelectEnumerator.new(self.source, self.selector) | |||
instance.isArray = isArray | |||
return instance | |||
end | end | ||
Line 156: | Line 150: | ||
local WhereEnumerator = setmetatable({}, { __index = Enumerator }) | local WhereEnumerator = setmetatable({}, { __index = Enumerator }) | ||
WhereEnumerator.__index = WhereEnumerator | WhereEnumerator.__index = WhereEnumerator | ||
WhereEnumerator.__pairs = Enumerator_mt.__pairs | WhereEnumerator.__pairs = Enumerator_mt.__pairs | ||
WhereEnumerator.__ipairs = Enumerator_mt.__ipairs | WhereEnumerator.__ipairs = Enumerator_mt.__ipairs | ||
Line 191: | Line 185: | ||
function WhereEnumerator:getEnumerator() | function WhereEnumerator:getEnumerator() | ||
local instance = (self.state == 0) and self or WhereEnumerator.new(self.source, self.predicate) | |||
instance.isArray = isArray | |||
return instance | |||
end | end | ||
Line 260: | Line 252: | ||
function SelectManyEnumerator:getEnumerator() | function SelectManyEnumerator:getEnumerator(isArray) | ||
local instance = (self.state == 0) and self or SelectManyEnumerator.new(self.source, self.selector) | |||
instance.isArray = isArray | |||
return instance | |||
end | end | ||
edits