コード例 #1
0
 public FunctionEnvironment([NotNull] ScriptFunctionObject function, ThisBindingStatus thisBindingStatus, ScriptObject homeObject, ScriptObject newTarget) :
     base(function.Agent)
 {
     FunctionObject         = function;
     this.thisBindingStatus = thisBindingStatus;
     this.homeObject        = homeObject;
     NewTarget = newTarget;
 }
コード例 #2
0
 public JsValue BindThisValue(JsValue value)
 {
     if (_thisBindingStatus == ThisBindingStatus.Initialized)
     {
         ExceptionHelper.ThrowReferenceError <JsValue>(_engine);
     }
     _thisValue         = value;
     _thisBindingStatus = ThisBindingStatus.Initialized;
     return(value);
 }
コード例 #3
0
 public JsValue BindThisValue(JsValue value)
 {
     if (_thisBindingStatus == ThisBindingStatus.Initialized)
     {
         ExceptionHelper.ThrowReferenceError(_functionObject._realm, (string)null);
     }
     _thisValue         = value;
     _thisBindingStatus = ThisBindingStatus.Initialized;
     return(value);
 }
コード例 #4
0
        public void BindThisValue(ScriptValue value)
        {
            //https://tc39.github.io/ecma262/#sec-bindthisvalue
            Debug.Assert(thisBindingStatus != ThisBindingStatus.Lexical);

            if (thisBindingStatus == ThisBindingStatus.Initialised)
            {
                throw FunctionObject.Agent.CreateReferenceError();
            }

            thisValue         = value;
            thisBindingStatus = ThisBindingStatus.Initialised;
        }
コード例 #5
0
 public FunctionEnvironmentRecord(
     Engine engine,
     FunctionInstance functionObject,
     JsValue newTarget) : base(engine)
 {
     _functionObject = functionObject;
     _newTarget      = newTarget;
     if (functionObject is ArrowFunctionInstance)
     {
         _thisBindingStatus = ThisBindingStatus.Lexical;
     }
     else
     {
         _thisBindingStatus = ThisBindingStatus.Uninitialized;
     }
 }