Rhino.ScriptRuntime.GetValueFunctionAndThis C# (CSharp) Method

GetValueFunctionAndThis() public static method

Prepare for calling (...): return function corresponding to and make parent scope of the function available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj.
Prepare for calling (...): return function corresponding to and make parent scope of the function available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj. The caller must call ScriptRuntime.lastStoredScriptable() immediately after calling this method.
public static GetValueFunctionAndThis ( object value, Context cx ) : Callable
value object
cx Context
return Callable
		public static Callable GetValueFunctionAndThis(object value, Context cx)
		{
			if (!(value is Callable))
			{
				throw NotFunctionError(value);
			}
			Callable f = (Callable)value;
			Scriptable thisObj = null;
			if (f is Scriptable)
			{
				thisObj = ((Scriptable)f).GetParentScope();
			}
			if (thisObj == null)
			{
				if (cx.topCallScope == null)
				{
					throw new InvalidOperationException();
				}
				thisObj = cx.topCallScope;
			}
			if (thisObj.GetParentScope() != null)
			{
				if (thisObj is NativeWith)
				{
				}
				else
				{
					// functions defined inside with should have with target
					// as their thisObj
					if (thisObj is NativeCall)
					{
						// nested functions should have top scope as their thisObj
						thisObj = ScriptableObject.GetTopLevelScope(thisObj);
					}
				}
			}
			StoreScriptable(cx, thisObj);
			return f;
		}
ScriptRuntime