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


C# TreeRealization.definition_node类代码示例

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


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

示例1: AddExternalMember

 //добавить внешнюю сущность
 public static void AddExternalMember(definition_node dn, int offset)
 {
     gl_members[dn] = offset;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:5,代码来源:PCUWriter.cs

示例2: SavePosition

        //то же самое, но только для членов класса (это лишнее можно объединить)
/*		private int SavePositionAndConstPoolInType(definition_node dn)
		{
            int pos = (int)bw.BaseStream.Position;
            members[dn] = pos;
			name_pool[dn].offset = pos;
			gl_members[dn] = pos;
            PCUWriter pw = null;
            if (not_comp_members.TryGetValue(dn,out pw))
             pw.AddOffsetForMembers(dn,pos);
            return pos;
		}*/
		
        //просто сохраняем смещение сущности
		private int SavePosition(definition_node dn)
		{
            int pos = (int)bw.BaseStream.Position;
            members[dn] = pos;
			gl_members[dn] = pos;
            return pos;
		}
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:21,代码来源:PCUWriter.cs

示例3: GetMemberOffset

        //получение смещения сущности в модуле
		private int GetMemberOffset(definition_node dn)
		{
			return members[dn];
		}
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:5,代码来源:PCUWriter.cs

示例4: GetExternalOffset

        //получение смещения в другом модуле
		private int GetExternalOffset(definition_node dn)
		{
            int off = -1;
            if (!gl_members.TryGetValue(dn, out off))
            {
                add_not_comp_members(dn, this);
                ext_offsets[dn] = imp_entitles.Count;
            }
            return off;
		}
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:11,代码来源:PCUWriter.cs

示例5: assign_doc_info

 private void assign_doc_info(definition_node dn, SyntaxTree.syntax_tree_node stn)
 {
 	string s = null;
 	if (docs != null && docs.TryGetValue(stn, out s) && !string.IsNullOrEmpty(s))
 	{
 		dn.documentation = s;
 	}
 	return;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:9,代码来源:syntax_tree_visitor.cs

示例6: AddOffsetForMembers

 //отложенное добавление смещения импортирумой сущности в список импорт. сущностей
 //используется при циклических связях модулей
 private void AddOffsetForMembers(definition_node dn, int offset)
 {
     if (!ext_offsets.ContainsKey(dn))
     {
     	return;
     }
 	int pos = ext_offsets[dn]; //берем индекс в списке имп. сущ.
    
     imp_entitles[pos].offset = offset; // сохраняем смещение в другом модуле
     ext_offsets.Remove(dn); //удаляем сущность из таблицы
     //if (ext_offsets.Count == 0) 
         //CloseWriter(); // если не разрешенных зависимостей больше нет, записываем модуль на диск
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:15,代码来源:PCUWriter.cs

示例7: get_member_definition

 public definition_node get_member_definition(definition_node instance_member)
 {
     return _member_definitions[instance_member] as definition_node;
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:4,代码来源:generics.cs

示例8: ConvertMember

        public definition_node ConvertMember(definition_node orig_node)
        {
            definition_node rez_node = _members[orig_node] as definition_node;
            if (rez_node == null)
            {
                //Преобразуем найденный член класса.
                SemanticTree.IClassMemberNode orig_member = orig_node as SemanticTree.IClassMemberNode;
                if (orig_member == null)
                {
                    //Для basic_function
                    generic_instance_type_node gitn = base_type as generic_instance_type_node;
                    if (gitn == null)
                        return orig_node;
                    else
                        return gitn.ConvertMember(orig_node);
                }
                type_node tn = orig_member.comperehensive_type as type_node;
                if (orig_member.comperehensive_type.is_generic_type_instance)
                    tn = tn.original_generic;
                if (tn != _original_generic)
                {
                    if (orig_member.comperehensive_type.is_generic_type_definition)
                    {
                        generic_instance_type_node compr_type = find_instance_type_from(orig_member.comperehensive_type as type_node);
                        if (compr_type == null)
                        {
                            compiled_function_node cfn = orig_node as compiled_function_node;
                            if (cfn == null)
                            {
                                return orig_node;
                            }
                            compiled_type_node cct = orig_member.comperehensive_type as compiled_type_node;
                            type_node inst_type = this;
                            do
                            {
                                inst_type = inst_type.base_type;
                            }
                            while (inst_type.semantic_node_type != semantic_node_type.compiled_type_node ||
                                (inst_type != cct && inst_type.original_generic != cct));


                            MethodInfo[] meths = cct._compiled_type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic |
                                BindingFlags.Static | BindingFlags.Instance);
                            int num = System.Array.IndexOf(meths, cfn.method_info);

                            MethodInfo mi = ((compiled_type_node)inst_type)._compiled_type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic |
                                BindingFlags.Static | BindingFlags.Instance)[num];
                            return compiled_function_node.get_compiled_method(mi);
                        }
                        else
                            return compr_type.ConvertMember(orig_node);
                    }
                    else if (orig_member.comperehensive_type.is_generic_type_instance)
                    {
                        generic_instance_type_node compr_type = find_instance_type_from(tn);
                        if (compr_type == null)
                        {
                            compiled_function_node cfn = orig_node as compiled_function_node;
                            if (cfn == null)
                            {
                                return orig_node;
                            }
                            compiled_type_node cct = tn as compiled_type_node;
                            type_node inst_type = this;
                            do
                            {
                                inst_type = inst_type.base_type;
                            }
                            while (inst_type.semantic_node_type != semantic_node_type.compiled_type_node ||
                                (inst_type != cct && inst_type.original_generic != cct));


                            MethodInfo[] meths = cct._compiled_type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic |
                                BindingFlags.Static | BindingFlags.Instance);
                            int num = System.Array.IndexOf(meths, cfn.method_info);

                            MethodInfo mi = ((compiled_type_node)inst_type)._compiled_type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic |
                                BindingFlags.Static | BindingFlags.Instance)[num];
                            return compiled_function_node.get_compiled_method(mi);
                        }
                        else
                            return compr_type.ConvertMember(orig_node);
                        //
                    }
                    else
                        return orig_node;
                }
                SemanticTree.ILocated orig_loc = orig_node as SemanticTree.ILocated;
                location loc = (orig_loc == null) ? null : (orig_loc.Location as location);
                switch (orig_node.general_node_type)
                {
                    case general_node_type.constant_definition:
                        constant_definition_node orig_cdn = orig_node as constant_definition_node;
                        rez_node = new class_constant_definition(
                            orig_cdn.name, orig_cdn.const_value,
                            loc, this, orig_member.field_access_level);
                        break;
                    case general_node_type.variable_node:
                        var_definition_node orig_cf = (var_definition_node)(orig_node);
                        rez_node = new class_field(orig_cf.name,
//.........这里部分代码省略.........
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:101,代码来源:generics.cs

示例9: create_class_static_field_reference

 private addressed_expression create_class_static_field_reference(type_node tn, definition_node dn,
     SyntaxTree.ident id_right)
 {
     switch (dn.semantic_node_type)
     {
         case semantic_node_type.class_field:
             {
                 class_field cf = (class_field)dn;
                 if (cf.polymorphic_state != SemanticTree.polymorphic_state.ps_static)
                 {
                     AddError(new CanNotReferenceToNonStaticFieldWithType(cf, get_location(id_right), tn));
                 }
                 static_class_field_reference scfr = new static_class_field_reference(cf, get_location(id_right));
                 return scfr;
             }
         case semantic_node_type.compiled_variable_definition:
             {
                 compiled_variable_definition cvd = (compiled_variable_definition)dn;
                 if (cvd.polymorphic_state != SemanticTree.polymorphic_state.ps_static)
                 {
                     AddError(new CanNotReferenceToNonStaticFieldWithType(cvd, get_location(id_right), tn));
                 }
                 static_compiled_variable_reference scvr = new static_compiled_variable_reference(cvd, get_location(id_right));
                 return scvr;
             }
     }
     throw new CompilerInternalError("Error in create static class field reference.");
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:28,代码来源:syntax_tree_visitor.cs

示例10: AddMember

 internal void AddMember(definition_node dn, int offset)
 {
     members[offset] = dn;
     AddReadOrWritedDefinitionNode(dn, offset);
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:5,代码来源:PCUReader.cs

示例11: create_class_field_reference

        private addressed_expression create_class_field_reference(expression_node en, definition_node dn, SyntaxTree.ident id_right)
        {
            try_convert_typed_expression_to_function_call(ref en);
            if (dn.semantic_node_type == semantic_node_type.class_field)
            {
                class_field cf = (class_field)dn;
                if (cf.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
                {
                    AddError(new CanNotReferanceToStaticFieldWithExpression(cf, get_location(id_right), en));
                }
                class_field_reference cfr = new class_field_reference(cf, en, get_location(id_right));
                //return_value(cfr);
                return cfr;
            }
            if (dn.semantic_node_type == semantic_node_type.compiled_variable_definition)
            {
                compiled_variable_definition cfd = (compiled_variable_definition)dn;
                if (cfd.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
                {
                    AddError(new CanNotReferanceToStaticFieldWithExpression(cfd, get_location(id_right), en));
                }
                compiled_variable_reference cfr2 = new compiled_variable_reference(cfd, en, get_location(id_right));
                //return_value(cfr2);
                return cfr2;
            }
#if (DEBUG)
            throw new CompilerInternalError("Invalid variable kind");
#endif
            return null;
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:30,代码来源:syntax_tree_visitor.cs

示例12: AddReadOrWritedDefinitionNode

 internal static void AddReadOrWritedDefinitionNode(definition_node dn, int offset)
 {
     if(!AllReadOrWritedDefinitionNodesOffsets.ContainsKey(dn))
         AllReadOrWritedDefinitionNodesOffsets.Add(dn, offset);
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:5,代码来源:PCUReader.cs

示例13: add_not_comp_members

 private static void add_not_comp_members(definition_node dn, PCUWriter pw)
 {
     if (not_comp_members.ContainsKey(dn))
     {
         not_comp_members[dn].Add(pw);
     }
     else
     {
         List<PCUWriter> l=new List<PCUWriter>();
         l.Add(pw);
         not_comp_members.Add(dn, l);
     }
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:13,代码来源:PCUWriter.cs

示例14: check_for_usage_attribute

        private void check_for_usage_attribute(definition_node dn, AttributeTargets targets, string name, location loc, SemanticTree.attribute_qualifier_kind qualifier)
        {
        	switch (dn.semantic_node_type)
        	{
        		case semantic_node_type.common_type_node : 
        			{
        				common_type_node ctn = dn as common_type_node;
        				if (ctn.IsDelegate)
        				{
        					if ((targets & (AttributeTargets.Delegate)) != (AttributeTargets.Delegate))
        						AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_DELEGATE", name);
        				}
        				else
        				if (ctn.IsInterface)
        				{
        					if ((targets & AttributeTargets.Interface) != AttributeTargets.Interface)
        						AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_INTERFACE", name);
        				}
        				else
        				if (ctn.IsEnum)
        				{
        					if ((targets & (AttributeTargets.Enum)) != (AttributeTargets.Enum))
        						AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_ENUM", name);
        				}
        				else
        				if (ctn.is_value_type)
        				{
        					if ((targets & AttributeTargets.Struct) != AttributeTargets.Struct)
        						AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_STRUCT", name);
        				}
        				else
        					if ((targets & AttributeTargets.Class) != AttributeTargets.Class)
        						AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_CLASS", name);
        			}
        			break;
        		case semantic_node_type.common_method_node:
        			if ((dn as common_method_node).is_constructor)
        			{
        				if ((targets & AttributeTargets.Constructor) != AttributeTargets.Constructor)
        					AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_CONSTRUCTOR", name);
        			}
        			else
        				if ((targets & AttributeTargets.Method) != AttributeTargets.Method && qualifier != SemanticTree.attribute_qualifier_kind.return_kind)
        					AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_METHOD", name);
        			break;
        		case semantic_node_type.common_namespace_function_node:
        			if ((targets & AttributeTargets.Method) != AttributeTargets.Method && qualifier != SemanticTree.attribute_qualifier_kind.return_kind)
        				AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_METHOD", name);
        			break;
        		case semantic_node_type.class_field:
        			if ((targets & AttributeTargets.Field) != AttributeTargets.Field)
        				AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_FIELD", name);
        			break;
        		case semantic_node_type.common_property_node:
        			if ((targets & AttributeTargets.Property) != AttributeTargets.Property)
        				AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_PROPERTY", name);
        			break;
                case semantic_node_type.common_namespace_event:
        		case semantic_node_type.common_event:
        			if ((targets & AttributeTargets.Event) != AttributeTargets.Event)
        				AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_EVENT", name);
        			break;
        		case semantic_node_type.common_parameter:
        			if ((targets & AttributeTargets.Parameter) != AttributeTargets.Parameter)
                        AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_FIELD", name);
					break;
                case semantic_node_type.common_unit_node:
                    if ((targets & AttributeTargets.Assembly) != AttributeTargets.Assembly)
        				AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_ASSEMBLY", name);
        			break;
        	}
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:72,代码来源:syntax_tree_visitor.cs

示例15: SaveOffsetForAttribute

 private void SaveOffsetForAttribute(definition_node dn)
 {
 	if (!attr_dict.ContainsKey(dn))
 	{
 		attr_dict[dn] = new List<int>();
 	}
 	attr_dict[dn].Add((int)bw.BaseStream.Position);
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:8,代码来源:PCUWriter.cs


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