当前位置: 首页>>代码示例>>C#>>正文


C# Context.GetMaximumInterpreterStackDepth方法代码示例

本文整理汇总了C#中Rhino.Context.GetMaximumInterpreterStackDepth方法的典型用法代码示例。如果您正苦于以下问题:C# Context.GetMaximumInterpreterStackDepth方法的具体用法?C# Context.GetMaximumInterpreterStackDepth怎么用?C# Context.GetMaximumInterpreterStackDepth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rhino.Context的用法示例。


在下文中一共展示了Context.GetMaximumInterpreterStackDepth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitFrame

		private static void InitFrame(Context cx, Scriptable callerScope, Scriptable thisObj, object[] args, double[] argsDbl, int argShift, int argCount, InterpretedFunction fnOrScript, Interpreter.CallFrame parentFrame, Interpreter.CallFrame frame)
		{
			InterpreterData idata = fnOrScript.idata;
			bool useActivation = idata.itsNeedsActivation;
			DebugFrame debuggerFrame = null;
			if (cx.debugger != null)
			{
				debuggerFrame = cx.debugger.GetFrame(cx, idata);
				if (debuggerFrame != null)
				{
					useActivation = true;
				}
			}
			if (useActivation)
			{
				// Copy args to new array to pass to enterActivationFunction
				// or debuggerFrame.onEnter
				if (argsDbl != null)
				{
					args = GetArgsArray(args, argsDbl, argShift, argCount);
				}
				argShift = 0;
				argsDbl = null;
			}
			Scriptable scope;
			if (idata.itsFunctionType != 0)
			{
				scope = fnOrScript.GetParentScope();
				if (useActivation)
				{
					scope = ScriptRuntime.CreateFunctionActivation(fnOrScript, scope, args);
				}
			}
			else
			{
				scope = callerScope;
				ScriptRuntime.InitScript(fnOrScript, thisObj, cx, scope, fnOrScript.idata.evalScriptFlag);
			}
			if (idata.itsNestedFunctions != null)
			{
				if (idata.itsFunctionType != 0 && !idata.itsNeedsActivation)
				{
					Kit.CodeBug();
				}
				for (int i = 0; i < idata.itsNestedFunctions.Length; i++)
				{
					InterpreterData fdata = idata.itsNestedFunctions[i];
					if (fdata.itsFunctionType == FunctionNode.FUNCTION_STATEMENT)
					{
						InitFunction(cx, scope, fnOrScript, i);
					}
				}
			}
			// Initialize args, vars, locals and stack
			int emptyStackTop = idata.itsMaxVars + idata.itsMaxLocals - 1;
			int maxFrameArray = idata.itsMaxFrameArray;
			if (maxFrameArray != emptyStackTop + idata.itsMaxStack + 1)
			{
				Kit.CodeBug();
			}
			object[] stack;
			int[] stackAttributes;
			double[] sDbl;
			bool stackReuse;
			if (frame.stack != null && maxFrameArray <= frame.stack.Length)
			{
				// Reuse stacks from old frame
				stackReuse = true;
				stack = frame.stack;
				stackAttributes = frame.stackAttributes;
				sDbl = frame.sDbl;
			}
			else
			{
				stackReuse = false;
				stack = new object[maxFrameArray];
				stackAttributes = new int[maxFrameArray];
				sDbl = new double[maxFrameArray];
			}
			int varCount = idata.GetParamAndVarCount();
			for (int i_1 = 0; i_1 < varCount; i_1++)
			{
				if (idata.GetParamOrVarConst(i_1))
				{
					stackAttributes[i_1] = ScriptableObject.CONST;
				}
			}
			int definedArgs = idata.argCount;
			if (definedArgs > argCount)
			{
				definedArgs = argCount;
			}
			// Fill the frame structure
			frame.parentFrame = parentFrame;
			frame.frameIndex = (parentFrame == null) ? 0 : parentFrame.frameIndex + 1;
			if (frame.frameIndex > cx.GetMaximumInterpreterStackDepth())
			{
				throw Context.ReportRuntimeError("Exceeded maximum stack depth");
			}
			frame.frozen = false;
//.........这里部分代码省略.........
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:101,代码来源:Interpreter.cs


注:本文中的Rhino.Context.GetMaximumInterpreterStackDepth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。