ES5ArrayIndexEnumerator.h 1.4 KB

12345678910111213141516171819202122232425262728
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. namespace Js
  7. {
  8. class ES5ArrayIndexEnumerator : public JavascriptArrayIndexEnumeratorBase
  9. {
  10. private:
  11. Field(uint32) initialLength; // The initial array length when this enumerator is created
  12. Field(uint32) dataIndex; // Current data index
  13. Field(uint32) descriptorIndex; // Current descriptor index
  14. Field(IndexPropertyDescriptor*) descriptor; // Current descriptor
  15. Field(void *) descriptorValidationToken;
  16. protected:
  17. DEFINE_VTABLE_CTOR(ES5ArrayIndexEnumerator, JavascriptArrayIndexEnumeratorBase);
  18. private:
  19. ES5Array* GetArray() const { return ES5Array::FromVar(arrayObject); }
  20. public:
  21. ES5ArrayIndexEnumerator(ES5Array* arrayObject, EnumeratorFlags flags, ScriptContext* scriptContext);
  22. virtual void Reset() override;
  23. virtual JavascriptString * MoveAndGetNext(PropertyId& propertyId, PropertyAttributes* attributes = nullptr) override;
  24. };
  25. }