本文整理汇总了C#中ProtoScript.Runners.ProtoScriptRunner.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# ProtoScript.Runners.ProtoScriptRunner.Execute方法的具体用法?C# ProtoScript.Runners.ProtoScriptRunner.Execute怎么用?C# ProtoScript.Runners.ProtoScriptRunner.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProtoScript.Runners.ProtoScriptRunner
的用法示例。
在下文中一共展示了ProtoScript.Runners.ProtoScriptRunner.Execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RedefineWithFunctions03
public void RedefineWithFunctions03()
{
String code =
@"
class C
{
mx : var;
constructor C()
{
mx = 10;
}
def f(a : int)
{
mx = a + 1;
return = mx;
}
}
x = 10;
p = C.C();
x = p.f(x);
";
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
runtimeCore = fsr.Execute(code, core); ExecutionMirror mirror = runtimeCore.Mirror;
Assert.IsTrue((Int64)mirror.GetValue("x").Payload == 11);
}
示例2:
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
fsr.Execute(
@"
[Associative]
{
a = [Imperative]
{
示例3: GetUpcastChainTest
public void GetUpcastChainTest()
{
String code =
@"class A {}
class B extends A {}
class C extends B {}
";
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
ProtoCore.RuntimeCore runtimeCore = null;
runtimeCore = fsr.Execute(code, core); ExecutionMirror mirror = runtimeCore.Mirror;
int idA = core.ClassTable.IndexOf("A");
int idB = core.ClassTable.IndexOf("B");
int idC = core.ClassTable.IndexOf("C");
ClassNode cnA = core.ClassTable.ClassNodes[idA];
ClassNode cnB = core.ClassTable.ClassNodes[idB];
ClassNode cnC = core.ClassTable.ClassNodes[idC];
List<int> idsA = ClassUtils.GetClassUpcastChain(cnA, runtimeCore);
List<int> idsB = ClassUtils.GetClassUpcastChain(cnB, runtimeCore);
List<int> idsC = ClassUtils.GetClassUpcastChain(cnC, runtimeCore);
Assert.IsTrue(idsA.Count == 2);
Assert.IsTrue(idsA.Contains(idA));
Assert.IsTrue(idsB.Count == 3);
Assert.IsTrue(idsB.Contains(idA));
Assert.IsTrue(idsB.Contains(idB));
Assert.IsTrue(idsC.Count == 4);
Assert.IsTrue(idsC.Contains(idA));
Assert.IsTrue(idsC.Contains(idB));
Assert.IsTrue(idsC.Contains(idC));
}
示例4: ExecuteAndVerify
protected int ExecuteAndVerify(String code, ValidationData[] data, Dictionary<string, Object> context, out int nErrors)
{
ProtoCore.Core core = Setup();
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
ProtoCore.CompileTime.Context compileContext = new ProtoCore.CompileTime.Context(code, context);
ProtoCore.RuntimeCore runtimeCore = null;
ExecutionMirror mirror = fsr.Execute(compileContext, core, out runtimeCore);
int nWarnings = runtimeCore.RuntimeStatus.WarningCount;
nErrors = core.BuildStatus.ErrorCount;
if (data == null)
{
runtimeCore.Cleanup();
return nWarnings + nErrors;
}
TestFrameWork thisTest = new TestFrameWork();
foreach (var item in data)
{
if (item.ExpectedValue == null)
{
object nullOb = null;
TestFrameWork.Verify(mirror, item.ValueName, nullOb, item.BlockIndex);
}
else
{
TestFrameWork.Verify(mirror, item.ValueName, item.ExpectedValue, item.BlockIndex);
}
}
runtimeCore.Cleanup();
return nWarnings + nErrors;
}
示例5: SimpleMethodOverload2
runtimeCore = fsr.Execute(code, core); ExecutionMirror mirror = runtimeCore.Mirror;
Assert.IsTrue((Int64)mirror.GetValue("x").Payload == 123);
Assert.IsTrue((Int64)mirror.GetValue("y").Payload == 345);
}
[Test]
[Category("DSDefinedClass_Ported")]
public void SimpleMethodOverload2()
示例6: scale
return = 0;
}
x = 10;
y = 40;
n = scale();
n = scale(10);
";
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
runtimeCore = fsr.Execute(code, core); ExecutionMirror mirror = runtimeCore.Mirror;
示例7: SimpleMethodOverload1
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
runtimeCore = fsr.Execute(code, core); ExecutionMirror mirror = runtimeCore.Mirror;
Assert.IsTrue((Int64)mirror.GetValue("x").Payload == 123);
Assert.IsTrue((Int64)mirror.GetValue("y").Payload == 345);
}
[Test]
[Category("DSDefinedClass_Ported")]
public void SimpleMethodOverload1()
示例8: ParserFailTest2
});
}
[Test]
public void ParserFailTest2()
{
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
//@TODO: What exception should this throw
Assert.Throws(typeof(ProtoCore.Exceptions.CompileErrorsOccured), () =>
{
fsr.Execute(
示例9: TestMultLanguageImperativeAssociative
b = 4;
}
", core, out runtimeCore);
}
[Test]
public void TestMultLanguageImperativeAssociative()
{
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
fsr.Execute(
@"
示例10: SimpleExpr
public void SimpleExpr()
{
ProtoScript.Runners.ProtoScriptRunner fsr = new ProtoScript.Runners.ProtoScriptRunner();
runtimeCore = fsr.Execute(
@"
[Associative]
{
a = 10;
}
", core);
}
示例11: RedefineWithFunctions03
public void RedefineWithFunctions03()
{
String code =
@"
class C
{
mx : var;
constructor C()
示例12: f
}
def f(a : int)
{
mx = a + 1;
return = mx;
}
}
x = 10;
示例13:
ExecutionMirror mirror = thisTest.RunScriptSource(code);
thisTest.Verify("f0", false);
thisTest.Verify("f1", false);
thisTest.Verify("f2", false);
thisTest.Verify("f3", false);
thisTest.Verify("t0", true);
thisTest.Verify("t1", true);
thisTest.Verify("t2", true);
示例14: PreClarifyPreParseBracket001
public void PreClarifyPreParseBracket001()
{
String code =
@"x;
[Associative]
{
a = {1001,1002};
// This is failing the pre-parse.
// Probably has somthing to do with convertingthe language blocks into binary exprs
示例15: LiteralRetrival
public void LiteralRetrival()
{
String code =
@"
foo;
[Associative]
{
foo = 5;
}