本文整理汇总了C#中Rhino.Context.InitStandardObjects方法的典型用法代码示例。如果您正苦于以下问题:C# Context.InitStandardObjects方法的具体用法?C# Context.InitStandardObjects怎么用?C# Context.InitStandardObjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Context
的用法示例。
在下文中一共展示了Context.InitStandardObjects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public object Run(Context cx)
{
cx.GetWrapFactory().SetJavaPrimitiveWrap(false);
NUnit.Framework.Assert.AreEqual("string[]", cx.EvaluateString(cx.InitStandardObjects(), "new org.mozilla.javascript.tests.Bug496585Test().method('one', 'two', 'three')", "<test>", 1, null));
NUnit.Framework.Assert.AreEqual("string+function", cx.EvaluateString(cx.InitStandardObjects(), "new org.mozilla.javascript.tests.Bug496585Test().method('one', function() {})", "<test>", 1, null));
return null;
}
示例2: Run
public object Run(Context cx)
{
Scriptable scope1 = cx.InitStandardObjects(new PrimitiveTypeScopeResolutionTest.MySimpleScriptableObject("scope1"));
Scriptable scope2 = cx.InitStandardObjects(new PrimitiveTypeScopeResolutionTest.MySimpleScriptableObject("scope2"));
cx.EvaluateString(scope2, scriptScope2, "source2", 1, null);
scope1.Put("scope2", scope1, scope2);
return cx.EvaluateString(scope1, scriptScope1, "source1", 1, null);
}
示例3: Run
public object Run(Context cx)
{
ScriptableObject top = cx.InitStandardObjects();
ScriptableObject.PutProperty(top, "foo", foo);
cx.EvaluateString(top, script, "script", 0, null);
return null;
}
示例4: Run
public object Run(Context _cx)
{
ScriptableObject scope = _cx.InitStandardObjects();
object result = _cx.EvaluateString(scope, script, "test script", 0, null);
NUnit.Framework.Assert.AreEqual("b1,b2,a0,a1,,a3", Context.ToString(result));
return null;
}
示例5: Run
public object Run(Context cx)
{
Scriptable scope = cx.InitStandardObjects();
object rep = cx.EvaluateString(scope, source, "test.js", 0, null);
NUnit.Framework.Assert.AreEqual(expected, rep);
return null;
}
示例6: Run
public object Run(Context cx)
{
Scriptable scope = cx.InitStandardObjects();
try
{
cx.EvaluateString(scope, _source, "test.js", 0, null);
}
catch (JavaScriptException e)
{
NUnit.Framework.Assert.AreEqual(_expectedStackTrace, e.GetScriptStackTrace());
return null;
}
throw new Exception("Exception expected!");
}
示例7: InitStandardObjects
public virtual void InitStandardObjects(Context cx, bool @sealed)
{
// Assume that Context.initStandardObjects initialize JavaImporter
// property lazily so the above init call is not yet called
cx.InitStandardObjects(this, @sealed);
topScopeFlag = true;
// If seal is true then exportAsJSClass(cx, seal) would seal
// this obj. Since this is scope as well, it would not allow
// to add variables.
IdFunctionObject ctor = ExportAsJSClass(MAX_PROTOTYPE_ID, this, false);
if (@sealed)
{
ctor.SealObject();
}
// delete "constructor" defined by exportAsJSClass so "constructor"
// name would refer to Object.constructor
// and not to JavaImporter.prototype.constructor.
Delete("constructor");
}
示例8: SetUp
public virtual void SetUp()
{
cx = Context.Enter();
cx.SetOptimizationLevel(-1);
scope = cx.InitStandardObjects();
}
示例9: Run
public object Run(Context _cx)
{
ScriptableObject scope = _cx.InitStandardObjects();
object result = _cx.EvaluateString(scope, script, "test script", 0, null);
return null;
}
示例10: Run
public object Run(Context cx)
{
this.cx = cx;
scope = cx.InitStandardObjects(null, true);
return Run();
}
示例11: SetUp
public virtual void SetUp()
{
cx = Context.Enter();
scope = cx.InitStandardObjects();
cx.SetLanguageVersion(170);
}
示例12: Run
public object Run(Context context)
{
Scriptable scope = context.InitStandardObjects();
scope.Put("myObj", scope, f);
return context.EvaluateString(scope, "typeof myObj", "test script", 1, null);
}
示例13: SetUp
public virtual void SetUp()
{
cx = Context.Enter();
scope = cx.InitStandardObjects();
}
示例14: Run
public object Run(Context cx)
{
try
{
ScriptableObject scope = cx.InitStandardObjects();
object o = cx.EvaluateString(scope, script, "myScript.js", 1, null);
NUnit.Framework.Assert.AreEqual(expected, o);
return o;
}
catch (Exception e)
{
throw;
}
catch (Exception e)
{
throw new Exception(e);
}
}
示例15: SetUp
public virtual void SetUp()
{
cx = Context.Enter();
parser = new JsonParser(cx, cx.InitStandardObjects());
}