MethodPropertyDescriptor.cs 807 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using Jint.Runtime.Interop;
  3. namespace Jint.Runtime.Descriptors.Specialized
  4. {
  5. public sealed class MethodPropertyDescriptor<T> : AccessorDescriptor
  6. {
  7. public MethodPropertyDescriptor(Engine engine, Func<T, object> get)
  8. : this(engine, get, null)
  9. {
  10. }
  11. public MethodPropertyDescriptor(Engine engine, Func<T, object> get, Action<T, object> set)
  12. : base(
  13. new GetterFunctionInstance<T>(engine, get),
  14. set == null ? null : new SetterFunctionInstance<T>(engine, set)
  15. )
  16. {
  17. }
  18. public override bool IsAccessorDescriptor()
  19. {
  20. return true;
  21. }
  22. public override bool IsDataDescriptor()
  23. {
  24. return false;
  25. }
  26. }
  27. }