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


C# VsaEngine.PopScriptObject方法代码示例

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


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

示例1: Construct

 internal ScriptFunction Construct(object[] args, VsaEngine engine)
 {
     ScriptFunction function;
     StringBuilder builder = new StringBuilder("function anonymous(");
     int index = 0;
     int num2 = args.Length - 2;
     while (index < num2)
     {
         builder.Append(Microsoft.JScript.Convert.ToString(args[index]));
         builder.Append(", ");
         index++;
     }
     if (args.Length > 1)
     {
         builder.Append(Microsoft.JScript.Convert.ToString(args[args.Length - 2]));
     }
     builder.Append(") {\n");
     if (args.Length > 0)
     {
         builder.Append(Microsoft.JScript.Convert.ToString(args[args.Length - 1]));
     }
     builder.Append("\n}");
     Context context = new Context(new DocumentContext("anonymous", engine), builder.ToString());
     JSParser parser = new JSParser(context);
     engine.PushScriptObject(((IActivationObject) engine.ScriptObjectStackTop()).GetGlobalScope());
     try
     {
         function = (ScriptFunction) parser.ParseFunctionExpression().PartiallyEvaluate().Evaluate();
     }
     finally
     {
         engine.PopScriptObject();
     }
     return function;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:FunctionConstructor.cs

示例2: JScriptEvaluate

 public static Object JScriptEvaluate(Object source, VsaEngine engine){
   if (Convert.GetTypeCode(source) != TypeCode.String)
     return source;
   if (engine.doFast)
     engine.PushScriptObject(new BlockScope(engine.ScriptObjectStackTop()));
   try{
     Context context = new Context(new DocumentContext("eval code", engine), ((IConvertible)source).ToString());
     JSParser p = new JSParser(context);
     return ((Completion)p.ParseEvalBody().PartiallyEvaluate().Evaluate()).value;
   }finally{
     if (engine.doFast)
       engine.PopScriptObject();
   }
 }
开发者ID:ArildF,项目名称:masters,代码行数:14,代码来源:eval.cs

示例3: Construct

 internal ScriptFunction Construct(Object[] args, VsaEngine engine){
   StringBuilder func_string = new StringBuilder("function anonymous(");
   for (int i = 0, n = args.Length-2; i < n; i++){
     func_string.Append(Convert.ToString(args[i]));
     func_string.Append(", ");
   }
   if (args.Length > 1)
     func_string.Append(Convert.ToString(args[args.Length-2]));
   func_string.Append(") {\n");
   if (args.Length > 0)
     func_string.Append(Convert.ToString(args[args.Length-1]));
   func_string.Append("\n}");
   Context context = new Context(new DocumentContext("anonymous", engine), func_string.ToString());
   JSParser p = new JSParser(context);
   engine.PushScriptObject(((IActivationObject)Globals.contextEngine.ScriptObjectStackTop()).GetGlobalScope());
   try{
     return (ScriptFunction)p.ParseFunctionExpression().PartiallyEvaluate().Evaluate();
   }finally{
     engine.PopScriptObject();
   }
 }
开发者ID:ArildF,项目名称:masters,代码行数:21,代码来源:functionconstructor.cs

示例4: catch

	// Perform a call on this object.
	internal override Object Call
				(VsaEngine engine, Object thisob, Object[] args)
			{
				// Create a new scope object and initialize the parameters.
				ScriptObject scope;
				if(thisob is JSObject)
				{
					scope = new FunctionScope
						((JSObject)thisob, defn.fparams, thisob, args);
				}
				else
				{
					scope = new FunctionScope
						(declaringScope, defn.fparams, thisob, args);
				}

				// Push the scope onto the stack.
				engine.PushScriptObjectChecked(scope);

				// Call the function and pop the scope afterwards.
				Object result = Empty.Value;
				try
				{
					if(defn.body != null)
					{
						defn.body.Eval(engine);
					}
				}
				catch(ReturnJumpOut r)
				{
					return r.value;
				}
				finally
				{
					engine.PopScriptObject();
				}

				// Return the function result to the caller.
				return result;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:41,代码来源:FunctionObject.cs

示例5: DoEvaluate

 private static object DoEvaluate(object source, VsaEngine engine, bool isUnsafe)
 {
     object obj2;
     if (engine.doFast)
     {
         engine.PushScriptObject(new BlockScope(engine.ScriptObjectStackTop()));
     }
     try
     {
         Context context = new Context(new DocumentContext("eval code", engine), ((IConvertible) source).ToString());
         JSParser parser = new JSParser(context);
         obj2 = ((Completion) parser.ParseEvalBody().PartiallyEvaluate().Evaluate()).value;
     }
     finally
     {
         if (engine.doFast)
         {
             engine.PopScriptObject();
         }
     }
     return obj2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:Eval.cs

示例6: Eval

	public override Object Eval(VsaEngine engine)
#line 447 "./Nodes/JStmt.tc"
	{
		Object result;
	
		// Evaluate the expression to use inside the "with" block
		// and push it onto the script object stack.
		try
		{
			With.JScriptWith(expr.Eval(engine), engine);
		}
		catch(JScriptException e)
		{
			e.context = expr.context.MakeCopy();
			throw e;
		}
	
		// Evaluate the body of the "with" block.
		try
		{
			result = body.Eval(engine);
		}
		finally
		{
			engine.PopScriptObject();
		}
		return result;
	}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:28,代码来源:JNode.cs

示例7: DoEvaluate

      private static Object DoEvaluate(Object source, VsaEngine engine, bool isUnsafe){
        if (engine.doFast)
          engine.PushScriptObject(new BlockScope(engine.ScriptObjectStackTop()));
        try{
          Context context = new Context(new DocumentContext("eval code", engine), ((IConvertible)source).ToString());
          JSParser p = new JSParser(context);
          if (!isUnsafe)
            new SecurityPermission(SecurityPermissionFlag.Execution).PermitOnly();
          return ((Completion)p.ParseEvalBody().PartiallyEvaluate().Evaluate()).value;
        }finally{
          if (engine.doFast)
            engine.PopScriptObject();
        }

      }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:15,代码来源:eval.cs

示例8: JScriptEvaluate

	// Evaluate a JScript expression in the context of a specific engine.
	public static Object JScriptEvaluate(Object source, VsaEngine engine)
			{
				Object value = null;

				// Bail out if we weren't supplied a string.
				if(!(source is String))
				{
					return source;
				}

				// Parse the "eval" statement.
				Context context = new Context((String)source);
				context.codebase = new CodeBase("eval code", null);
				JSParser parser = new JSParser(context);
				JNode node = parser.ParseSource(true);

				// Push a scope for use during evaluation.
				engine.PushScriptObject
					(new BlockScope(engine.ScriptObjectStackTop(),
									new JSObject (null, engine)));

				// Evaluate the statement.
				try
				{
					value = node.Eval(engine);
					if(value == Empty.Value)
					{
						value = null;
					}
				}
				catch(JScriptException e)
				{
					// Attach the context information to low-level exceptions.
					if(e.context == null)
					{
						e.context = context;
					}
					throw;
				}
				catch(BreakJumpOut brk)
				{
					// "break" used incorrectly.
					throw new JScriptException(JSError.BadBreak, brk.context);
				}
				catch(ContinueJumpOut cont)
				{
					// "continue" used incorrectly.
					throw new JScriptException(JSError.BadContinue,
											   cont.context);
				}
				catch(ReturnJumpOut ret)
				{
					// "return" used incorrectly.
					throw new JScriptException(JSError.BadReturn, ret.context);
				}
				finally
				{
					// Pop the script scope.
					engine.PopScriptObject();
				}

				// Return the result of the evaluation to the caller.
				return value;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:65,代码来源:Eval.cs


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