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


C# ScriptThread.Bind方法代码示例

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


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

示例1: DoEvaluate

		protected override object DoEvaluate(ScriptThread thread)
		{
			// standard prolog
			thread.CurrentNode = this;

			var binding = thread.Bind(FunctionName, BindingRequestFlags.Read);
			var result = binding.GetValueRef(thread);
			if (result == null)
			{
				thread.ThrowScriptError("Unknown identifier: {0}", FunctionName);
				return null;
			}

			CallTarget = result as ICallTarget;
			if (CallTarget == null)
			{
				thread.ThrowScriptError("This identifier cannot be called: {0}", FunctionName);
				return null;
			}

			// set Evaluate pointer
			Evaluate = DoCall;

			// standard epilog is done by DoCall
			return DoCall(thread);
		}
开发者ID:Rezura,项目名称:LiveSplit,代码行数:26,代码来源:FunctionCall.cs

示例2: DoEvaluate

 //Executed only once, on the first call
 protected override object DoEvaluate(ScriptThread thread)
 {
     thread.CurrentNode = this;  //standard prolog
       _accessor = thread.Bind(Symbol, BindingRequestFlags.Read);
       this.Evaluate = _accessor.GetValueRef; // Optimization - directly set method ref to accessor's method. EvaluateReader;
       var result = this.Evaluate(thread);
       thread.CurrentNode = Parent; //standard epilog
       return result;
 }
开发者ID:MarcusTheBold,项目名称:Irony,代码行数:10,代码来源:IdentifierNode.cs

示例3: DoSetValue

 public override void DoSetValue(ScriptThread thread, object value)
 {
     thread.CurrentNode = this;  //standard prolog
       if (_accessor == null) {
     _accessor = thread.Bind(Symbol, BindingRequestFlags.Write | BindingRequestFlags.ExistingOrNew);
       }
       _accessor.SetValueRef(thread, value);
       thread.CurrentNode = Parent;  //standard epilog
 }
开发者ID:MarcusTheBold,项目名称:Irony,代码行数:9,代码来源:IdentifierNode.cs

示例4: DoEvaluate

		public string Name { get; set; } // TODO: value.Replace("-", "__")

		protected override object DoEvaluate(ScriptThread thread)
		{
			// standard prolog
			thread.CurrentNode = this;

			// define function: bind function name to the current instance
			var binding = thread.Bind(Name, BindingRequestFlags.Write | BindingRequestFlags.NewOnly);
			binding.SetValueRef(thread, this);

			// set Evaluate method and return the current node
			Evaluate = t => this;

			// standard epilog
			thread.CurrentNode = Parent;
			return this;
		}
开发者ID:androdev4u,项目名称:XLParser,代码行数:18,代码来源:Function.cs

示例5: DoEvaluate

		protected override object DoEvaluate(ScriptThread thread)
		{
			// standard prolog
			thread.CurrentNode = this;

			if (EntryPoint == null)
			{
				thread.ThrowScriptError("No entry point defined (entry point is a function named «Go»)");
				return null;
			}

			// define built-in runtime library functions
			var libraryFunctions = LibraryFunction.ExtractLibraryFunctions(thread, new RefalLibrary(thread));
			foreach (var libFun in libraryFunctions)
			{
				var binding = thread.Bind(libFun.Name, BindingRequestFlags.Write | BindingRequestFlags.ExistingOrNew);
				binding.SetValueRef(thread, libFun);
			}

			// define functions declared in the compiled program
			foreach (var fun in FunctionList)
			{
				fun.Evaluate(thread);
			}

			// call entry point with an empty expression
			EntryPoint.Call(thread, new object[] { PassiveExpression.Build() });

			// standard epilog
			thread.CurrentNode = Parent;
			return null;
		}
开发者ID:androdev4u,项目名称:XLParser,代码行数:32,代码来源:Program.cs


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