本文整理汇总了C#中CodeGenContext.ldstr方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGenContext.ldstr方法的具体用法?C# CodeGenContext.ldstr怎么用?C# CodeGenContext.ldstr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGenContext
的用法示例。
在下文中一共展示了CodeGenContext.ldstr方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Assign
internal override void Assign(CodeGenContext context, Node rhs)
{
// object value = rhs;
bool created;
ISimple value = context.PreCompute(rhs, "rhs", out created);
// thisblock.localsN.SetDynamic("vid", value);
context.ldarg(0);
context.ldfld(block.frameFields[depth - 1]);
context.ldstr(Name);
value.GenSimple(context);
context.call(Runtime.Frame.SetDynamic);
value.GenSimple(context);
context.ReleaseLocal(value, created);
}
示例2: GenSimple
public void GenSimple(CodeGenContext context)
{
if (value is string)// T_STRING,
{
context.ldstr((string)(value));
context.newobj(Runtime.String.ctor);
return;
}
if (value is int) // T_FIXNUM
{
context.ldc_i4((int)(value));
context.box(PrimitiveType.Int32);
return;
}
if (value is double)// T_FLOAT
{
context.ldc_r8((double)(value));
context.newobj(Runtime.Float.ctor);
return;
}
if (value is ID) // T_SYMBOL
{
context.ldstr(((ID)value).ToString());
context.newobj(Runtime.Symbol.ctor);
return;
}
if (value is BigNum)
{
BigNum num = (BigNum) value;
context.ldc_i4(num.sign);
context.ldstr(num.ToString());
context.ldc_i4(num.bas);
context.newobj(Runtime.Bignum.ctor);
return;
}
throw new System.NotImplementedException("VALUE " + value.GetType().ToString());
}
示例3: Defined
internal override void Defined(CodeGenContext context)
{
// Variables.gvar_defined(vid);
context.ldstr(vid.ToString());
context.call(Runtime.Variables.gvar_defined);
}
示例4: GenCall0
internal override void GenCall0(CodeGenContext context)
{
// Ruby.Eval.Call???(self, frame, method_id, arguments);
self.GenSimple(context);
context.ldloc(0);
context.ldstr(method_id.ToString());
if (args.ShortAndSimple())
{
foreach (ISimple arg in fixed_arguments)
arg.GenSimple(context);
if (IsPublic)
context.call(Runtime.Eval.Call("Public", fixed_arguments.Count-1));
else
context.call(Runtime.Eval.Call("Private", fixed_arguments.Count-1));
}
else
{
arguments.GenSimple(context);
if (IsPublic)
context.call(Runtime.Eval.CallPublicA);
else
context.call(Runtime.Eval.CallPrivateA);
}
}
示例5: GenSimple
public void GenSimple(CodeGenContext context)
{
// Fixme: make sure CurrentRubyClass is not a singleton (see cvar_cbase)
// Ruby.Variables.cvar_get(caller, ruby_cref, "vid");
context.ldloc(0);
context.ruby_cbase(parent_scope);
context.ldstr(vid.ToString());
context.call(Runtime.Variables.cvar_get);
}
示例6: GenCode0
internal override void GenCode0(CodeGenContext context)
{
if (qualified)
if (scope != null)
scope.GenCode(context);
else
context.ldsfld(Ruby.Compiler.Runtime.Init.rb_cObject);
else
context.ruby_cbase(parent_scope);
context.ldstr(vid.ToString());
context.ldloc(0);
context.call(Runtime.Eval.get_const);
}
示例7: DefineClass
internal override void DefineClass(CodeGenContext context, PERWAPI.FieldDef singleton)
{
// Class.define_module(scope, name.vid, caller);
context.ldarg("scope");
context.ldstr(name.vid.ToString());
context.ldloc(0);
context.call(Runtime.Class.rb_define_module);
context.stsfld(singleton);
}
示例8: GenCode0
internal override void GenCode0(CodeGenContext context)
{
if (id is string)
context.ldstr((string)id);
else if (id is VALUE && ((VALUE)id).value is string)
context.ldstr((string)((VALUE)id).value);
else
{
((Node)id).GenCode(context);
context.ldfld(Runtime.String.value);
}
context.newobj(Runtime.Symbol.ctor);
}
示例9: CopyNormalFormals
private void CopyNormalFormals(CodeGenContext context, Scope scope)
{
PERWAPI.CILLabel OKLabel = context.NewLabel();
if (min_args > 0)
{
// if (args.Length < min_args)
context.ldarg("args");
context.callvirt(Runtime.ArgList.get_Length);
int length = context.StoreInTemp("length", PrimitiveType.Int32, location);
context.ldloc(length);
context.ldc_i4(min_args);
context.bge(OKLabel);
//context.Inst(Op.clt);
//context.brfalse(OKLabel);
// context.Branch(BranchOp.bge, OKLabel);
// throw new ArgumentError(string.Format("wrong number of arguments ({0} for {1})", args.Length, arity).raise(caller);
// FIXME: next line needs a String
context.ldstr("wrong number of arguments ({0} for {1})");
context.ldloc(length);
context.box(PrimitiveType.Int32);
context.ldc_i4(min_args);
context.box(PrimitiveType.Int32);
context.call(Runtime.SystemString.Format);
context.newobj(Runtime.ArgumentError.ctor);
context.ldloc(0);
context.callvirt(Runtime.Exception.raise);
context.throwOp();
context.ReleaseLocal(length, true);
// OKLabel:
context.CodeLabel(OKLabel);
}
// Copy parameters to locals
for (Node f = normal; f != null; f = f.nd_next)
{
string name = ID.ToDotNetName(((VAR)f).vid);
// local.f = args.GetNext();
context.ldloc(0);
context.ldarg("args");
context.callvirt(Runtime.ArgList.GetNext);
context.stfld(scope.GetFrameField(name));
}
}
示例10: MethodDefined
internal override void MethodDefined(CodeGenContext context)
{
// Eval.FindSuperMethod(last_class, thisFrame, currentMethod)
context.LastClass(parent_scope, false);
context.ldloc(0);
context.ldstr(ParentMethodName(context));
context.call(Runtime.Eval.FindSuperMethod);
}
示例11: GenCode0
internal override void GenCode0(CodeGenContext context)
{
// ruby_class.undef_method(mid);
context.newLine(location);
context.ruby_class(parent_scope);
context.ldstr(mid.ToString());
context.callvirt(Runtime.Class.undef_method);
context.ldnull();
}
示例12: DefineMethod
internal void DefineMethod(CodeGenContext context)
{
// ... .define_method("MyMethod", MyMethod.singleton, arity, caller);
context.ldstr(method_id.ToString());
context.ldsfld(GenerateClassForMethod(context));
context.ldc_i4(formals.arity);
context.ldloc(0);
context.callvirt(Runtime.Class.define_method);
context.ldnull();
}
示例13: GenCode0
internal override void GenCode0(CodeGenContext context)
{
// new Regexp(pattern, options);
if (pattern is VALUE)
context.ldstr(((VALUE)pattern).value.ToString());
else
{
pattern.GenCode(context);
context.callvirt(Runtime.String.ToString);
}
context.ldc_i4(options);
context.newobj(Runtime.Regexp.ctor);
}