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


C# TreeRealization.type_node类代码示例

本文整理汇总了C#中PascalABCCompiler.TreeRealization.type_node的典型用法代码示例。如果您正苦于以下问题:C# type_node类的具体用法?C# type_node怎么用?C# type_node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


type_node类属于PascalABCCompiler.TreeRealization命名空间,在下文中一共展示了type_node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTemplateParametersTypeDependsOn

        private static List<ident> GetTemplateParametersTypeDependsOn(type_node type)
        {
            if (type.generic_function_container != null)
            {
                return new List<ident>
                    {
                        new ident(type.name)
                    };
            }

            var typeRef = type as ref_type_node;
            if (typeRef != null)
            {
                return GetTemplateParametersTypeDependsOn(typeRef.pointed_type);
            }

            var typeIi = type.get_internal_interface(internal_interface_kind.unsized_array_interface) as array_internal_interface;
            if (typeIi != null)
            {
                return GetTemplateParametersTypeDependsOn(typeIi.element_type);
            }

            if (type.type_special_kind == PascalABCCompiler.SemanticTree.type_special_kind.set_type)
            {
                return GetTemplateParametersTypeDependsOn(type.element_type);
            }

            if (type.IsDelegate)
            {
                var dii = type.get_internal_interface(internal_interface_kind.delegate_interface) as delegate_internal_interface;
                var res = new List<ident>();
                if (dii != null)
                {
                    var paramCount = dii.parameters.Count;
                    for (var i = 0; i < paramCount; i++)
                    {
                        res.AddRange(GetTemplateParametersTypeDependsOn(dii.parameters[i].type));
                    }
                }
                return res;
            }

            if (type.is_generic_type_instance)
            {
                var pcount = type.instance_params.Count;
                var res = new List<ident>();

                for (var i = 0; i < pcount; i++)
                {
                    res.AddRange(GetTemplateParametersTypeDependsOn(type.instance_params[i]));
                }
                return res;
            }

            return new List<ident>();
        }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:56,代码来源:LambdaCapturedSymbolsHelper.cs

示例2: common_event

 	public common_event(string name, type_node del_type, common_type_node cont_type, common_method_node add_method, common_method_node remove_method, common_method_node raise_method, 
 	                    SemanticTree.field_access_level fal, SemanticTree.polymorphic_state ps, location loc)
 	{
 		this._name = name;
 		this.del_type = del_type;
 		this._add_method = add_method;
 		this._remove_method = remove_method;
 		this._raise_method = raise_method;
 		this._field_access_level = fal;
 		this._polymorphic_state = ps;
 		this._cont_type = cont_type;
 		this._loc = loc;
 	}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:13,代码来源:events.cs

示例3: TypeDependedFromTemplate

 public static bool TypeDependedFromTemplate(type_node tn)
 {
     common_type_node ctn = tn as common_type_node;
     if (ctn == null)
     {
         return false;
     }
     if (ctn.original_template != null)
     {
         return true;
     }
     switch (tn.type_special_kind)
     {
         case PascalABCCompiler.SemanticTree.type_special_kind.array_kind:
         case PascalABCCompiler.SemanticTree.type_special_kind.set_type:
         //case PascalABCCompiler.SemanticTree.type_special_kind.typed_file:
             return TypeDependedFromTemplate(tn.element_type);
     }
     return false;
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:20,代码来源:templates.cs

示例4: GetSizeOfReference

 private int GetSizeOfReference(type_node tn)
 {
     if (tn == null)
         return sizeof(byte);
     if (tn.is_generic_parameter)
     {
         return sizeof(byte) + GetSizeOfReference(tn.generic_type_container as type_node) + sizeof(int);
     }
     generic_instance_type_node gitn = tn as generic_instance_type_node;
     if (gitn != null)
     {
         int rez = sizeof(byte) + GetSizeOfReference(gitn.original_generic) + sizeof(int);
         foreach (type_node par in gitn.instance_params)
         {
             rez += GetSizeOfReference(par);
         }
         return rez;
     }
     return sizeof(byte) + sizeof(int);
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:20,代码来源:PCUWriter.cs

示例5: WriteTypeReference

        //запись ссылки на тип
        //флаг|смещение
		private void WriteTypeReference(type_node type)
		{
            if (type == null)
            {
                bw.Write((System.Byte)255);
                return;
            }
			//если это массив
            if (type.semantic_node_type == semantic_node_type.simple_array)
            {
                WriteArrayType((simple_array)type);
                return;
            }
            //если это указатель
            //Наверно также надо сохранять Pointer,
            //  пока он востанавливается из таблицы nethelper.special_types
            if (type.semantic_node_type == semantic_node_type.ref_type_node)
            {
                WritePointerType((ref_type_node)type);
                return;
            }
            if (type.semantic_node_type == semantic_node_type.short_string)
            {
            	WriteShortStringType((short_string_type_node)type);
            	return;
            }
            internal_interface ii=type.get_internal_interface(internal_interface_kind.unsized_array_interface);
            //(ssyy) 18.05.2008 Убрал проверку на compiled_type_node
            if (ii != null) //&& type.element_type is compiled_type_node)
            {
                array_internal_interface aii=(array_internal_interface)ii;
                WriteUnsizedArrayType(type,aii);
                return;
            }
            /*
            ii = type.get_internal_interface(internal_interface_kind.bounded_array_interface);
            if (ii != null)
            {
                bounded_array_interface bai = (bounded_array_interface)ii;
                WriteBoundedArray(bai);
                return;
            }
            */
            
            //Пишем параметр generic-типа
            if (type.is_generic_parameter)
            {
                WriteGenericParameter(type as common_type_node);
                return;
            }

            //Пишем инстанцию generic-типа
            generic_instance_type_node gitn = type as generic_instance_type_node;
            if (gitn != null)
            {
                WriteGenericTypeInstance(gitn);
                return;
            }

            //Пишем инстанцию шаблонного класса
            common_type_node c_t_n = type as common_type_node;
            if (c_t_n != null && c_t_n.original_template != null)
            {
                WriteTemplateInstance(c_t_n);
                return;
            }

            byte is_def = 0;
			int offset = GetTypeReference(type, ref is_def);
			bw.Write(is_def); //пишем флаг импортируемый ли это тип или нет
			bw.Write(offset); // сохраняем его смещение (это либо смещение в самом модуле, либо в списке импорт. сущностей)
		}
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:74,代码来源:PCUWriter.cs

示例6: mark_byte_as_ordinal

        /*
        private static void mark_byte_as_ordinal()
        {
            basic_function_node inc_value_method = create_inc_value_method(SemanticTree.basic_function_type.binc, _byte_type);
            basic_function_node dec_value_method = create_dec_value_method(SemanticTree.basic_function_type.bdec, _byte_type);

            basic_function_node inc_method = create_inc_method(SemanticTree.basic_function_type.binc, _byte_type);
            basic_function_node dec_method = create_dec_method(SemanticTree.basic_function_type.bdec, _byte_type);

            SymbolInfo si = _byte_type.find_in_type(compiler_string_consts.greq_name);
            basic_function_node greq = (basic_function_node)si.sym_info;

            si = _byte_type.find(compiler_string_consts.smeq_name);
            basic_function_node loeq = (basic_function_node)si.sym_info;

            constant_node cn_max = new byte_const_node(byte.MaxValue, null);
            constant_node cn_min = new byte_const_node(byte.MinValue, null);

            basic_function_node i2i_method = create_emty_function(byte_type);

            ordinal_type_to_int ordinal_type_to_int = byte_to_int;

            ordinal_type_interface oti = new ordinal_type_interface(inc_method, dec_method, inc_value_method, dec_value_method,
                internal_inc_value, internal_dec_value, loeq, greq, cn_min, cn_max, i2i_method, ordinal_type_to_int);

            _byte_type.add_internal_interface(oti);
        }
        */
        private static void mark_type_as_ordinal(type_node type,
            SemanticTree.basic_function_type inc,SemanticTree.basic_function_type dec,
            SemanticTree.basic_function_type vinc, SemanticTree.basic_function_type vdec,
            constant_node lower_value, constant_node upper_value,
            function_node t2i,ordinal_type_to_int t2i_comp)
        {
            basic_function_node inc_value = create_oti_method(inc, type, SemanticTree.parameter_type.value);
            basic_function_node dec_value = create_oti_method(dec, type, SemanticTree.parameter_type.value);

            basic_function_node inc_var = create_oti_method(vinc, type, SemanticTree.parameter_type.var);
            basic_function_node dec_var = create_oti_method(vdec, type, SemanticTree.parameter_type.var);

            SymbolInfo si = type.find_in_type(compiler_string_consts.greq_name);
            basic_function_node greq = (basic_function_node)si.sym_info;
        
            si = type.find(compiler_string_consts.smeq_name);
            basic_function_node loeq = (basic_function_node)si.sym_info;
			
            si = type.find(compiler_string_consts.sm_name);
            basic_function_node lo = (basic_function_node)si.sym_info;
            
            si = type.find(compiler_string_consts.gr_name);
            basic_function_node gr = (basic_function_node)si.sym_info;
            
            ordinal_type_interface oti = new ordinal_type_interface(inc_value, dec_value, inc_var, dec_var,
                loeq, greq, lo, gr, lower_value, upper_value, t2i, t2i_comp);

            type.add_internal_interface(oti);
        }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:57,代码来源:StaticSystemLib.cs

示例7: create_dec_method

 private static basic_function_node create_dec_method(SemanticTree.basic_function_type bft, type_node type)
 {
     basic_function_node bfn = create_oti_method(bft, type, SemanticTree.parameter_type.var);
     bfn.compile_time_executor = dec_compile_time_executor;
     return bfn;
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:6,代码来源:StaticSystemLib.cs

示例8: add_generated_funtion_to_type

 public static void add_generated_funtion_to_type(string oper_name, type_node to, function_node fn)
 {
     to.add_generated_name(oper_name, new SymbolInfo(fn));
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:4,代码来源:StaticSystemLib.cs

示例9: make_type_conversion

        public static basic_function_node make_type_conversion(type_node from, type_node to, type_compare tc,
            SemanticTree.basic_function_type bft, bool is_implicit)
        {
            basic_function_node conv_method = new basic_function_node(bft, to,false);
            basic_parameter bp = new basic_parameter(compiler_string_consts.unary_param_name,
                from, SemanticTree.parameter_type.value, conv_method);
            conv_method.parameters.AddElement(bp);

            type_table.add_type_conversion_from_defined(from, to, conv_method, tc, is_implicit);
            //type_intersection_node inter_node = new type_intersection_node(tc);
            //inter_node.this_to_another = new type_conversion(conv_method,!is_implicit);
            //from.add_intersection_node(to, inter_node);
			add_stand_type(bft, conv_method);
            return conv_method;
        }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:15,代码来源:StaticSystemLib.cs

示例10: make_not_equivalence_operator

 public static basic_function_node make_not_equivalence_operator(type_node ctn)
 {
     return make_object_operator(ctn, SemanticTree.basic_function_type.objnoteq, compiler_string_consts.noteq_name, _bool_type);
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:4,代码来源:StaticSystemLib.cs

示例11: make_assign_operator

 private static basic_function_node make_assign_operator(type_node ctn)
 {
     return make_assign_operator(ctn, SemanticTree.basic_function_type.objassign);
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:4,代码来源:StaticSystemLib.cs

示例12: make_object_operator

 private static basic_function_node make_object_operator(type_node ctn, SemanticTree.basic_function_type bas_ft, string name,
     type_node ret_type)
 {
     return make_object_operator(ctn, bas_ft, name, ret_type, SemanticTree.parameter_type.value);
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:5,代码来源:StaticSystemLib.cs

示例13: CanUseThisTypeForTypedFiles

 public static bool CanUseThisTypeForTypedFiles(type_node tn)
 {
     return writable_in_typed_files_types[tn] != null;
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:4,代码来源:StaticSystemLib.cs

示例14: make_binary_operator

 public static basic_function_node make_binary_operator(string operator_name, type_node to)
 {
     return make_binary_operator(operator_name, to, PascalABCCompiler.SemanticTree.basic_function_type.none, to);
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:4,代码来源:StaticSystemLib.cs

示例15: init_reference_type

 public static void init_reference_type(type_node ctn)
 {
 	if (_bool_type == null) 
 	{
 		wait_add_ref_list.Add(ctn);
 		return;
 	}
     if (!ctn.is_ref_inited)
     {
         make_assign_operator(ctn);
         make_equivalence_operator(ctn);
         make_not_equivalence_operator(ctn);
         ctn.is_ref_inited = true;
     }
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:15,代码来源:StaticSystemLib.cs


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