本文整理汇总了C#中ElaValue.DirectGetString方法的典型用法代码示例。如果您正苦于以下问题:C# ElaValue.DirectGetString方法的具体用法?C# ElaValue.DirectGetString怎么用?C# ElaValue.DirectGetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElaValue
的用法示例。
在下文中一共展示了ElaValue.DirectGetString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Concatenate
internal override ElaValue Concatenate(ElaValue left, ElaValue right, ExecutionContext ctx)
{
right = right.Ref.Force(right, ctx);
if (right.TypeId != ElaMachine.STR)
{
if (right.TypeId == ElaMachine.CHR)
return new ElaValue(left.DirectGetString() + right.ToString());
NoOverloadBinary(TCF.STRING, right, "concatenate", ctx);
return Default();
}
return new ElaValue(left.DirectGetString() + right.DirectGetString());
}
示例2: GreaterEqual
internal override bool GreaterEqual(ElaValue left, ElaValue right, ExecutionContext ctx)
{
if (right.TypeId != ElaMachine.STR)
{
NoOverloadBinary(TCF.STRING, right, "greaterequal", ctx);
return false;
}
return left.DirectGetString().CompareTo(right.DirectGetString()) <= 0;
}
示例3: Equal
internal override bool Equal(ElaValue left, ElaValue right, ExecutionContext ctx)
{
if (right.TypeId != ElaMachine.STR)
{
NoOverloadBinary(TCF.STRING, right, "equal", ctx);
return false;
}
return left.DirectGetString() == right.DirectGetString();
}
示例4: IsNil
internal override bool IsNil(ElaValue left, ExecutionContext ctx)
{
return left.DirectGetString().Length == 0;
}
示例5: Head
internal override ElaValue Head(ElaValue left, ExecutionContext ctx)
{
return new ElaValue(left.DirectGetString()[0]);
}
示例6: HasField
internal bool HasField(ElaValue index, ExecutionContext ctx)
{
if (vm != null)
{
if (index.TypeId != ElaMachine.STR)
{
ctx.InvalidType(TCF.GetShortForm(ElaTypeCode.String), index);
return false;
}
var frame = vm.Assembly.GetModule(Handle);
return frame.GlobalScope.Locals.ContainsKey(index.DirectGetString());
}
ctx.Fail(ElaRuntimeError.Unknown, "VM is non present");
return false;
}
示例7: GetField
internal ElaValue GetField(ElaValue index, ExecutionContext ctx)
{
if (vm != null)
{
if (index.TypeId != ElaMachine.STR)
{
ctx.InvalidType(TCF.GetShortForm(ElaTypeCode.String), index);
return Default();
}
var field = index.DirectGetString();
var frame = vm.Assembly.GetModule(Handle);
ScopeVar sc;
if (!frame.GlobalScope.Locals.TryGetValue(field, out sc))
{
ctx.UnknownField(index.DirectGetString(), new ElaValue(this));
return Default();
}
if ((sc.Flags & ElaVariableFlags.Private) == ElaVariableFlags.Private)
{
ctx.Fail(new ElaError(ElaRuntimeError.PrivateVariable, field));
return Default();
}
return vm.modules[Handle][sc.Address];
}
ctx.Fail(ElaRuntimeError.Unknown, "VM is non present");
return Default();
}