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


C# CodeGenContext.call方法代码示例

本文整理汇总了C#中CodeGenContext.call方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGenContext.call方法的具体用法?C# CodeGenContext.call怎么用?C# CodeGenContext.call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CodeGenContext的用法示例。


在下文中一共展示了CodeGenContext.call方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
        }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:17,代码来源:Variables.cs

示例2: ReturnArray

 protected void ReturnArray(CodeGenContext context)
 {
     // Ruby.Eval.Return(array, caller);
     array.GenCode(context);
     context.ldloc(0);
     context.call(Runtime.Eval.Return);
 }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:7,代码来源:ControlFlow.cs

示例3: GenCode0

        internal override void GenCode0(CodeGenContext context)
        {
            PERWAPI.CILLabel elseLabel = context.NewLabel();
            PERWAPI.CILLabel endLabel = context.NewLabel();

            // if (Eval.Test(cond))
            cond.GenCode(context);
            context.call(Runtime.Eval.Test);
            context.brfalse(elseLabel);
            body.GenCode(context);
            context.br(endLabel);
            context.CodeLabel(elseLabel);
            _else.GenCode(context);
            context.CodeLabel(endLabel);
        }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:15,代码来源:Stmts.cs

示例4: GenSimple

 public void GenSimple(CodeGenContext context)
 {
     // Eval.ivar_get(recv, vid)
     context.ldarg("recv");
     context.ldstr(vid);
     context.call(Runtime.Eval.ivar_get);
 }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:7,代码来源:Variables.cs

示例5: Defined

   internal override void Defined(CodeGenContext context)
 {
     // Eval.ivar_defined(recv, vid)
     context.ldarg("recv");
     context.ldstr(vid);
     context.call(Runtime.Eval.ivar_defined);
 }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:7,代码来源:Variables.cs

示例6: GenCode0

        internal override void GenCode0(CodeGenContext context)
        {
            CodeGenContext Begin = context.CreateMethod(FileClass(), MethAttr.PublicStatic, "Begin" + (seq++), PrimitiveType.Object,
                    new Param(ParamAttr.Default, "recv", PrimitiveType.Object),
                    new Param(ParamAttr.Default, "caller", Runtime.FrameRef));

            Begin.startMethod(this.location);

            AddScopeLocals(Begin);

            AddScopeBody(Begin);

            Begin.ReleaseLocal(0, true);

            Begin.Close();


            // Begin(recv, caller);
            context.ldarg("recv");
            context.ldloc(0);
            context.call(Begin.Method);
            context.pop();
        }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:23,代码来源:Methods.cs

示例7: GenCode

        internal void GenCode(CodeGenContext context, PERWAPI.CILLabel endLabel, int RescueTemp, int exception)
        {
            for (RESCUE_CLAUSE clause = this; clause != null; clause = clause.next)
            {
                PERWAPI.CILLabel nextClause = context.NewLabel();
                PERWAPI.CILLabel thisClause = context.NewLabel();

                context.ldc_i4(0);
                LOCAL exceptionCaught = context.StoreInLocal("caught", PERWAPI.PrimitiveType.Boolean, this.location);

                for (Node type = clause.types; type != null; type = type.nd_next)
                {
                    PERWAPI.CILLabel label1 = context.NewLabel();

                    // Precompute each separately to avoid computing a list of types
                    type.GenCode0(context);
                    LOCAL tt = context.StoreInLocal("type", PERWAPI.PrimitiveType.Object, type.location);

                    new METHOD_CALL(tt, ID.intern(Tokens.tEQQ), new AST.LOCAL(exception, type.location), type.location).GenCode(context);

                    context.ReleaseLocal(tt.local, true);

                    context.call(Runtime.Eval.Test);
                    context.brfalse(label1);
                    context.PushTrue();
                    context.stloc(exceptionCaught.local);
                    context.CodeLabel(label1);                  
                }

                context.ldloc(exceptionCaught.local);
                context.brtrue(thisClause);
                context.ReleaseLocal(exceptionCaught.local, true);

                context.br(nextClause);

                context.CodeLabel(thisClause);

                if (clause.var != null)
                {
                    clause.var.Assign(context, new AST.LOCAL(exception, clause.var.location));
                    context.pop();
                }

                if (clause.body != null)
                    clause.body.GenCode(context);
                else
                    context.ldnull();

                if (context.Reachable())
                    context.stloc(RescueTemp);

                // reset $!
                //Eval.ruby_errinfo.value = null;
                context.ldsfld(Runtime.Eval.ruby_errinfo);
                context.ldnull();
                context.stfld(Runtime.global_variable.value);

                context.Goto(endLabel);

                context.CodeLabel(nextClause);
            }
        }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:62,代码来源:Exceptions.cs

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

示例9: GenCode0

 internal override void GenCode0(CodeGenContext context)
 {
     // Eval.alias(ruby_class, lhs, rhs, myFrame);
     context.newLine(location);
     context.ruby_class(parent_scope);
     context.ldstr(lhs.ToString());
     context.ldstr(rhs.ToString());
     context.ldloc(0);
     context.call(Runtime.Eval.alias);
 }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:10,代码来源:Operators.cs

示例10: GenCode0


//.........这里部分代码省略.........
            else
                skeleton = new ClassSkeleton(basename, classRef);
            skeleton.lexicalParent = context.currentSkeleton;
            newContext.currentSkeleton = skeleton;
            skeleton.lexicalParent.nestedClasses[basename] = skeleton;

            if (!superClassFound && this is AST.CLASS && ((AST.CLASS)this).super_class != null && defineInteropClass)
            {
                // do not add to post pass list if supertype is a built-in Ruby class
                //List<string> qualifiedSuperClass = ClassSkeleton.ConstNodeToClassList(((AST.CLASS)this).super_class);
                //if (!(qualifiedSuperClass.Count == 1 && Ruby.Runtime.BuiltinClasses.IsBuiltinClass(qualifiedSuperClass[0])))
                newContext.postPassList.Add(new ClassSkeletonPostPass(skeleton, interopClass, ((AST.CLASS)this).super_class));
            }
          
            //    public static Class classname;
            int seqNo = 0;
            internal_name = basename;
            while (FileClass().GetField(internal_name) != null)
                internal_name = basename + (seqNo++);

            // Define singleton in file class so that it gets initialized by .cctor
            singletonField = FileClass().AddField(PERWAPI.FieldAttr.PublicStatic, internal_name, Runtime.ClassRef);
            newContext.CurrentRubyClass = singletonField;

            //    public MyClass() : base(singleton) { };
            CodeGenContext class_constructor = null; 
            if (defineInteropClass)
            {
                if (interopClass.GetMethod(".ctor", new Type[0]) == null)
                {
                    CodeGenContext class_constructor0 = newContext.CreateConstructor(interopClass);
                    class_constructor0.ldarg(0);
                    if (superClassConstructor0 != null)
                        class_constructor0.call(superClassConstructor0);
                    else
                    {
                        class_constructor0.ldsfld(singletonField);
                        class_constructor0.call(superClassConstructor1);
                    }
                    class_constructor0.ret();
                    class_constructor0.Close();
                }


                //    public MyClass(Class klass) : base(klass) { };
                MethodDef ctor = interopClass.GetMethod(".ctor", new Type[] { Runtime.ClassRef });
                //CodeGenContext class_constructor;
                if (ctor == null)
                {
                    class_constructor = newContext.CreateConstructor(interopClass, new Param(ParamAttr.Default, "klass", Runtime.ClassRef));
                    class_constructor.ldarg(0);
                    class_constructor.ldarg("klass");
                    class_constructor.call(superClassConstructor1);
                    class_constructor.ret();
                    class_constructor.Close();
                }
                else
                {
                    class_constructor = new CodeGenContext();
                    class_constructor.Method = ctor;
                }
            }

            //    internal static void Init_fullname(object scope, object super, object recv, Frame caller) {
            CodeGenContext Init = newContext.CreateMethod(FileClass(), MethAttr.PublicStatic, "Init_" + internal_name, PrimitiveType.Object,
                    new Param(ParamAttr.Default, "scope", PrimitiveType.Object),
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:67,代码来源:ClassesAndModules.cs

示例11: 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);
 }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:9,代码来源:ClassesAndModules.cs

示例12: RHSAsArray

 private void RHSAsArray(CodeGenContext context)
 {
     // Array.Store(rhs);
     rhs.GenCode(context);
     context.call(Runtime.Array.Store);
 }
开发者ID:chunlea,项目名称:rubydotnetcompiler,代码行数:6,代码来源:Assignments.cs


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