AuxArray.h 887 B

123456789101112131415161718192021222324252627282930
  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. void SetCount(uint count) { this->count = count; }
  17. size_t GetDataSize() const { return sizeof(AuxArray) + sizeof(T) * count; }
  18. };
  19. typedef AuxArray<Var> VarArray;
  20. struct FuncInfoEntry
  21. {
  22. uint nestedIndex;
  23. uint scopeSlot;
  24. };
  25. typedef AuxArray<FuncInfoEntry> FuncInfoArray;
  26. }