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


C# SemanticTree.new_obj_awaited方法代码示例

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


在下文中一共展示了SemanticTree.new_obj_awaited方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: visit

        //вызов откомпилированного конструктора
        public override void visit(SemanticTree.ICompiledConstructorCall value)
        {
            //if (save_debug_info) MarkSequencePoint(value.Location);
            bool tmp_dot = is_dot_expr;
            MethodInfo mi = null;
            IParameterNode[] parameters = value.constructor.parameters;
            IExpressionNode[] real_parameters = value.real_parameters;
            Type cons_type11 = value.constructor.comprehensive_type.compiled_type;
            if (cons_type11.BaseType == TypeFactory.MulticastDelegateType)
            {
                SemanticTree.IFunctionCallNode ifc = real_parameters[0] as SemanticTree.IFunctionCallNode;
                ICompiledMethodCallNode icmcn = ifc as ICompiledMethodCallNode;
                if (icmcn != null)
                {
                    mi = icmcn.compiled_method.method_info;
                }
                else
                {
                    ICompiledStaticMethodCallNode icsmcn = ifc as ICompiledStaticMethodCallNode;
                    if (icsmcn != null)
                    {
                        mi = icsmcn.static_method.method_info;
                    }
                    else
                    {
                        mi = helper.GetMethod(ifc.function).mi;
                    }
                }
                PushObjectCommand(ifc);
                il.Emit(OpCodes.Ldftn, mi);
                il.Emit(OpCodes.Newobj, value.constructor.constructor_info);
                return;
            }

            //ssyy
            if (!value.new_obj_awaited())
            {
                il.Emit(OpCodes.Ldarg_0);
            }
            //\ssyy
            is_dot_expr = false;
            
            for (int i = 0; i < real_parameters.Length; i++)
            {
                if (parameters[i].parameter_type == parameter_type.var)
                    is_addr = true;
                real_parameters[i].visit(this);
                ICompiledTypeNode ctn2 = parameters[i].type as ICompiledTypeNode;
                ITypeNode ctn3 = real_parameters[i].type;
                if (ctn2 != null && !(real_parameters[i] is SemanticTree.INullConstantNode) && value.type != null && (ctn3.is_value_type || ctn3.is_generic_parameter) && ctn2.compiled_type == TypeFactory.ObjectType)
                    il.Emit(OpCodes.Box, helper.GetTypeReference(ctn3).tp);
                is_addr = false;
            }
            //ssyy изменил
            if (value.new_obj_awaited())
            {
                il.Emit(OpCodes.Newobj, value.constructor.constructor_info);
            }
            else
            {
                il.Emit(OpCodes.Call, value.constructor.constructor_info);
            }
            EmitFreePinnedVariables();
            if (tmp_dot == true)
            {
                //MethodInfo mi = value.compiled_method.method_info;
                if (value.constructor.constructor_info.DeclaringType.IsValueType && !NETGeneratorTools.IsPointer(value.constructor.constructor_info.DeclaringType))
                {
                    LocalBuilder lb = il.DeclareLocal(value.constructor.constructor_info.DeclaringType);
                    il.Emit(OpCodes.Stloc, lb);
                    il.Emit(OpCodes.Ldloca, lb);
                }
            }
            else
            {
                is_dot_expr = false;
            }
            //\ssyy            
        }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:80,代码来源:NETGenerator.cs


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