本文整理汇总了C#中Microsoft.JScript.Vsa.VsaEngine.GetMainScope方法的典型用法代码示例。如果您正苦于以下问题:C# VsaEngine.GetMainScope方法的具体用法?C# VsaEngine.GetMainScope怎么用?C# VsaEngine.GetMainScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.JScript.Vsa.VsaEngine
的用法示例。
在下文中一共展示了VsaEngine.GetMainScope方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Eval
public override Object Eval(VsaEngine engine)
#line 97 "./Nodes/JExpr.tc"
{
IVariableAccess scope = (engine.ScriptObjectStackTop() as IVariableAccess);
while(scope != null)
{
if(scope.HasVariable(name))
{
return scope.GetVariable(name);
}
scope = scope.GetParentScope();
}
return ((IVariableAccess)(engine.GetMainScope())).GetVariable(name);
}
示例2: GetAndPrepare
public override Object GetAndPrepare(VsaEngine engine, ref Object data1, ref Object data2)
#line 130 "./Nodes/JExpr.tc"
{
IVariableAccess scope = (engine.ScriptObjectStackTop() as IVariableAccess);
while(scope != null)
{
if(scope.HasVariable(name))
{
data1 = scope;
return scope.GetVariable(name);
}
scope = scope.GetParentScope();
}
scope = (IVariableAccess)(engine.GetMainScope());
data1 = scope;
return scope.GetVariable(name);
}
示例3: Construct
// Perform a constructor call on this object.
internal override Object Construct(VsaEngine engine, Object[] args)
{
String parameters;
String body;
String defn;
int index;
JSParser parser;
JFunction func;
// Collect up the parameters and body.
if(args.Length == 0)
{
parameters = String.Empty;
body = String.Empty;
}
else if(args.Length == 1)
{
parameters = String.Empty;
body = Convert.ToString(args[0]);
}
else
{
parameters = Convert.ToString(args[0]);
for(index = 1; index < (args.Length - 1); ++index)
{
parameters =
String.Concat(parameters, ",",
Convert.ToString(args[index]));
}
body = Convert.ToString(args[args.Length - 1]);
}
// Build a complete function definition and parse it.
defn = "function (" + parameters + ") { " + body + " }";
parser = new JSParser(new Context(defn));
func = parser.ParseFunctionSource();
// Build the function object and return it.
return new FunctionObject
(EngineInstance.GetEngineInstance(engine)
.GetFunctionPrototype(), func,
engine.GetMainScope());
}