AuxArray.h 972 B

12345678910111213141516171819202122232425262728293031
  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. template<typename T>
  9. struct AuxArray
  10. {
  11. uint32 count;
  12. T elements[];
  13. AuxArray(uint32 count) : count(count)
  14. {
  15. }
  16. static size_t OffsetOfElements() { return offsetof(AuxArray<T>, elements); }
  17. void SetCount(uint count) { this->count = count; }
  18. size_t GetDataSize() const { return sizeof(AuxArray) + sizeof(T) * count; }
  19. };
  20. typedef AuxArray<Var> VarArray;
  21. struct FuncInfoEntry
  22. {
  23. uint nestedIndex;
  24. uint scopeSlot;
  25. };
  26. typedef AuxArray<FuncInfoEntry> FuncInfoArray;
  27. }