JintThisExpression.cs 726 B

123456789101112131415161718192021222324
  1. using Esprima.Ast;
  2. namespace Jint.Runtime.Interpreter.Expressions
  3. {
  4. internal sealed class JintThisExpression : JintExpression
  5. {
  6. public JintThisExpression(ThisExpression expression) : base(expression)
  7. {
  8. }
  9. protected override ExpressionResult EvaluateInternal(EvaluationContext context)
  10. {
  11. return NormalCompletion(context.Engine.ResolveThisBinding());
  12. }
  13. public override Completion GetValue(EvaluationContext context)
  14. {
  15. // need to notify correct node when taking shortcut
  16. context.LastSyntaxElement = _expression;
  17. return Completion.Normal(context.Engine.ResolveThisBinding(), _expression);
  18. }
  19. }
  20. }