ArrayInstance.cs 765 B

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