ArrayInstance.cs 690 B

12345678910111213141516171819202122232425262728293031323334
  1. using System.Collections.Generic;
  2. using Jint.Native.Object;
  3. namespace Jint.Native.Array
  4. {
  5. public sealed class ArrayInstance : ObjectInstance
  6. {
  7. private readonly Stack<object> _array = new Stack<object>();
  8. public ArrayInstance(ObjectInstance prototype) : base(prototype)
  9. {
  10. }
  11. public override string Class
  12. {
  13. get
  14. {
  15. return "Array";
  16. }
  17. }
  18. public double Length { get { return _array.Count; } }
  19. public void Push(object o)
  20. {
  21. _array.Push(o);
  22. }
  23. public object Pop()
  24. {
  25. return _array.Pop();
  26. }
  27. }
  28. }