//добавление в таблицу символов имена членов класса
        private string[] AddClassMemberNames(WrappedClassScope scope)
        {
            int num = br.ReadInt32();
            string[] names = new string[num];
            for (int i = 0; i < num; i++)
            {
                PCUSymbolInfo si = new PCUSymbolInfo();
                string name = br.ReadString();
                si.sym_info = new wrapped_definition_node(br.ReadInt32(),this);
                //PCUReturner.AddPCUReader((wrapped_definition_node)si.sym_info, this);
                si.access_level = (access_level)br.ReadByte();

                si.symbol_kind = (symbol_kind)br.ReadByte();
                si.semantic_node_type = (semantic_node_type)br.ReadByte();
                si.virtual_slot = br.ReadBoolean();
                //Вроде это ненужно
                //SymbolInfo si2 = scope.FindWithoutCreation(name);
                //si.Next = si2;
                scope.AddSymbol(name, si);
                names[i] = name;
            }
            return names;
        }
		private definition_node CreateInterfaceCommonType(string name, int offset)
		{
            definition_node dn = null;
            if (members.TryGetValue(offset, out dn))
                return dn as common_type_node;
            common_type_node ctn = null;

            bool is_interface = br.ReadBoolean();
            int ind = br.ReadInt32();
            
            if (is_interface)//пропускаем флаг - интерфейсности
            {
                name = GetString(br.ReadInt32());
            }
            else
            {
                name = br.ReadString();
            }
			//br.ReadInt32();
            //Читаем, является ли тип интерфейсом
            bool type_is_interface = (br.ReadByte() == 1);

            //Читаем, является ли тип делегатом
            bool type_is_delegate = (br.ReadByte() == 1);

            //Читаем, является ли тип описанием дженерика
            bool type_is_generic_definition = (br.ReadByte() == 1);

            List<SemanticTree.ICommonTypeNode> type_params = null;
            if (type_is_generic_definition)
            {
                type_params = ReadGenericParams((is_interface) ? cun.namespaces[0] : cun.namespaces[1]);
            }

            WrappedInterfaceScope iscope = null;
            WrappedClassScope scope;
            if (type_is_interface)
            {
                iscope = new WrappedInterfaceScope(this, cun.scope, null);
                scope = iscope;
            }
            else
            {
                scope = new WrappedClassScope(this, cun.scope, null);
            }
            ctn = new wrapped_common_type_node(this, null, name, SemanticTree.type_access_level.tal_public, cun.namespaces[0], scope, null, offset);
            if (is_interface)
                AddTypeToOrderList(ctn, ind);
            else
                AddImplTypeToOrderList(ctn, ind);
            if (type_is_generic_definition)
            {
                ctn.is_generic_type_definition = true;
                ctn.generic_params = type_params;
            }
            AddMember(ctn, offset);
            
            int_members.Insert(0,ctn);

            type_node base_type = GetTypeReference();
            bool is_value_type = br.ReadBoolean();

            //Читаем поддерживаемые интерфейсы
            List<SemanticTree.ITypeNode> interf_implemented = ReadImplementingInterfaces();
            //int interf_count = br.ReadInt32();
            //List<SemanticTree.ITypeNode> interf_implemented = new List<SemanticTree.ITypeNode>(interf_count);
            //for (int i = 0; i < interf_count; i++)
            //{
            //    interf_implemented.Add(GetTypeReference());
            //}
			constant_node low_val=null;
			constant_node upper_val=null;
            SemanticTree.type_access_level tal = (SemanticTree.type_access_level)br.ReadByte();
            SemanticTree.type_special_kind tsk = (SemanticTree.type_special_kind)br.ReadByte();
            ctn.SetIsSealed(br.ReadBoolean());
            ctn.SetIsAbstract(br.ReadBoolean());
            ctn.IsPartial = br.ReadBoolean();
            
            if (tsk == SemanticTree.type_special_kind.diap_type)
            {
            	low_val = CreateExpression() as constant_node;
            	upper_val = CreateExpression() as constant_node;
            }
			
            if (type_is_interface)
            {
                //Добавляем ссылки на области видимости предков интерфейса
                List<SymbolTable.Scope> interf_scopes = new List<SymbolTable.Scope>();
                foreach (type_node tnode in interf_implemented)
                {
                    interf_scopes.Add(tnode.Scope);
                }
                iscope.TopInterfaceScopeArray = interf_scopes.ToArray();
            }
            //ctn = new wrapped_common_type_node(this, base_type, name, tal, cun.namespaces[0], scope, null, offset);
            //AddMember(ctn, offset);
            //int_members.Insert(0,ctn);
            ctn.SetBaseType(base_type);
            ctn.IsInterface = type_is_interface;
            ctn.IsDelegate = type_is_delegate;
            ctn.ImplementingInterfaces.AddRange(interf_implemented);
            ctn.internal_is_value = is_value_type;
            ctn.type_special_kind = tsk;
            if (ctn.full_name == "PABCSystem.BinaryFile")
                ctn.type_special_kind = SemanticTree.type_special_kind.binary_file;
            if (type_is_generic_definition)
            {
                foreach (common_type_node par in type_params)
                {
                    par.generic_type_container = ctn;
                    ReadTypeParameterEliminations(par);
                }
            }
            type_node elemnet_type = null;
            if (CanReadObject())
                elemnet_type = GetTypeReference();
            ctn.element_type = elemnet_type;
			if (ctn.type_special_kind != SemanticTree.type_special_kind.set_type)
            {
            	SystemLibrary.SystemLibrary.init_reference_type(ctn);
            }
            if (ctn.type_special_kind == SemanticTree.type_special_kind.set_type)
            {
            	ctn = compilation_context.AddTypeToSetTypeList(ctn);
            }
            if (ctn.type_special_kind == SemanticTree.type_special_kind.typed_file)
            {
            	ctn = compilation_context.AddTypeToTypedFileList(ctn);
            }
            br.ReadInt32();//comprehensive unit;
            ctn.attributes.AddRange(GetAttributes());
            //common_namespace_node ns = cun.namespaces[0];
            byte flag = br.ReadByte();
            int def_prop_off=0;
            if (flag == 1)
            {
                def_prop_off = br.ReadInt32();
            }
            location loc= ReadDebugInfo();
            ctn.loc = loc;
            if (type_is_delegate)
            {
                SystemLibrary.SystemLibrary.type_constructor.AddOperatorsToDelegate(ctn, loc);
            }
			
            //создаем scope для класса
            //ctn = new wrapped_common_type_node(this, base_type, name, tal, ns, scope, loc, offset);
            //members[offset] = ctn;
            //AddMember(ctn, offset);
            class_names[ctn] = AddClassMemberNames(scope);
            if (flag == 1) ctn.default_property = GetPropertyNode(def_prop_off); 
            //ivan
            if (ctn.IsEnum) 
            {
            	AddEnumOperators(ctn);
            	MakeTypeAsOrdinal(ctn,0,class_names.Count);
            	ctn.add_additional_enum_operations();
            }
            if (ctn.type_special_kind == SemanticTree.type_special_kind.diap_type)
            {
            	type_constructor.add_convertions_to_diap(ctn,low_val,upper_val);
            }
            if (ctn.type_special_kind == SemanticTree.type_special_kind.array_kind)
            {
            	if (!(ctn.element_type is compiled_type_node))
            	{
            		type_constructor.make_array_interface(ctn);
            	}
            }
            //RestoreAllFields(ctn);
            if(!waited_types_to_restore_fields.Contains(ctn))
                waited_types_to_restore_fields.Add(ctn);

            if (type_is_delegate)
            {
                SymbolInfo sim = ctn.find_in_type(compiler_string_consts.invoke_method_name);
                common_method_node invoke_method = sim.sym_info as common_method_node;
                sim = ctn.find_in_type(compiler_string_consts.default_constructor_name);
                common_method_node constructor = sim.sym_info as common_method_node;
                delegate_internal_interface dii = new delegate_internal_interface(invoke_method.return_value_type, invoke_method, constructor);
                dii.parameters.AddRange(invoke_method.parameters);
                ctn.add_internal_interface(dii);
            }
            
            /*if (ctn.type_special_kind == PascalABCCompiler.SemanticTree.type_special_kind.array_wrapper)
            {
            	bounded_array_interface bai = new bounded_array_interface(oti_indexer, ctn.element_type, cpn, oti_indexer.lower_value.type, int_arr);
				ctn.add_internal_interface(bai);
            }*/
            if (type_is_interface)
            {
                RestoreAllFields(ctn);
            }
            if (ctn.is_value)
            {
            	RestoreAllFields(ctn);
            }
            if (ctn.is_generic_type_definition)
            {
                foreach (common_type_node par in ctn.generic_params)
                {
                    SymbolInfo tsi = ctn.find_in_type(compiler_string_consts.generic_param_kind_prefix + par.name);
                    if (tsi != null)
                    {
                        par.runtime_initialization_marker = tsi.sym_info as class_field;
                    }
                }
            }
            /*if (ctn.type_special_kind == SemanticTree.type_special_kind.array_wrapper)
            {
            	RestoreAllFields(ctn);
            }*/
            
                return ctn;
		}