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


C# Context.InitStandardObjects方法代码示例

本文整理汇总了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;
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:Bug496585Test.cs

示例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);
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:8,代码来源:PrimitiveTypeScopeResolutionTest.cs

示例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;
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:WriteReadOnlyPropertyTest.cs

示例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;
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:ArrayConcatTest.cs

示例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;
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:7,代码来源:FunctionTest.cs

示例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!");
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:14,代码来源:StackTraceTest.cs

示例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");
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:19,代码来源:ImporterTopLevel.cs

示例8: SetUp

		public virtual void SetUp()
		{
			cx = Context.Enter();
			cx.SetOptimizationLevel(-1);
			scope = cx.InitStandardObjects();
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:6,代码来源:Bug685403Test.cs

示例9: Run

			public object Run(Context _cx)
			{
				ScriptableObject scope = _cx.InitStandardObjects();
				object result = _cx.EvaluateString(scope, script, "test script", 0, null);
				return null;
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:6,代码来源:DeletePropertyTest.cs

示例10: Run

			public object Run(Context cx)
			{
				this.cx = cx;
				scope = cx.InitStandardObjects(null, true);
				return Run();
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:6,代码来源:Bug708801Test.cs

示例11: SetUp

		public virtual void SetUp()
		{
			cx = Context.Enter();
			scope = cx.InitStandardObjects();
			cx.SetLanguageVersion(170);
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:6,代码来源:Bug714204Test.cs

示例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);
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:6,代码来源:TypeOfTest.cs

示例13: SetUp

		public virtual void SetUp()
		{
			cx = Context.Enter();
			scope = cx.InitStandardObjects();
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:5,代码来源:Test262RegExpTest.cs

示例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);
				}
			}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:18,代码来源:ErrorPropertiesTest.cs

示例15: SetUp

		public virtual void SetUp()
		{
			cx = Context.Enter();
			parser = new JsonParser(cx, cx.InitStandardObjects());
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:5,代码来源:JsonParserTest.cs


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