public SymbolInfo(class_field value)
		{
			//_name_information_type=name_information_type.nit_class_field;
			_sym_info=value;
			_access_level=get_class_member_access_level(value);
			_symbol_kind=symbol_kind.sk_none;
		}
 //добавить внешнюю сущность
 public static void AddExternalMember(definition_node dn, int offset)
 {
     gl_members[dn] = offset;
 }
        //то же самое, но только для членов класса (это лишнее можно объединить)
/*		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;
		}
        //получение смещения сущности в модуле
		private int GetMemberOffset(definition_node dn)
		{
			return members[dn];
		}
        //получение смещения в другом модуле
		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;
		}
 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;
 }
 //отложенное добавление смещения импортирумой сущности в список импорт. сущностей
 //используется при циклических связях модулей
 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(); // если не разрешенных зависимостей больше нет, записываем модуль на диск
 }
Beispiel #8
0
 public definition_node get_member_definition(definition_node instance_member)
 {
     return _member_definitions[instance_member] as definition_node;
 }
Beispiel #9
0
        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,
                            generic_convertions.determine_type(orig_cf.type, _instance_params, false),
                            this, orig_member.polymorphic_state,
                            orig_member.field_access_level, loc);
                        break;
                    case general_node_type.property_node:
                        property_node orig_pn = (property_node)(orig_node);
                        rez_node = make_property(orig_pn, loc);
                        break;
                    case general_node_type.function_node:
                        function_node orig_fn = (function_node)(orig_node);
                        rez_node = make_method(orig_fn, loc);
                        break;
                    case general_node_type.event_node:
                        //(ssyy) Не знаю, что тут делать
                        rez_node = orig_node;
                        break;
                    default:
                        throw new CompilerInternalError("Unexpected definition_node.");
                }
                AddMember(orig_node, rez_node);
            }
            return rez_node;
        }
		public SymbolInfo(type_node value)
		{
			_sym_info=value;
			_access_level=access_level.al_public;
			_symbol_kind=symbol_kind.sk_none;
		}
 public SymbolInfo(definition_node value, access_level alevel, symbol_kind skind)
 {
     _sym_info = value;
     _access_level = alevel;
     _symbol_kind = skind;
 }
		public SymbolInfo(common_property_node value)
		{
			//_name_information_type=name_information_type.nit_common_property;
			_sym_info=value;
			_access_level=get_class_member_access_level(value);
			_symbol_kind=symbol_kind.sk_none;
		}
		public SymbolInfo(constant_definition_node value)
		{
			//_name_information_type=name_information_type.nit_constant_defnition;
			_sym_info=value;
			_access_level=access_level.al_public;
			_symbol_kind=symbol_kind.sk_none;
		}
		public SymbolInfo(basic_parameter value)
		{
			//_name_information_type=name_information_type.nit_basic_parameter;
			_sym_info=value;
			_access_level=access_level.al_public;
			_symbol_kind=symbol_kind.sk_none;
		}
 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.");
 }
 internal void AddMember(definition_node dn, int offset)
 {
     members[offset] = dn;
     AddReadOrWritedDefinitionNode(dn, offset);
 }
        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;
        }
 internal static void AddReadOrWritedDefinitionNode(definition_node dn, int offset)
 {
     if(!AllReadOrWritedDefinitionNodesOffsets.ContainsKey(dn))
         AllReadOrWritedDefinitionNodesOffsets.Add(dn, offset);
 }
 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);
     }
 }
        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;
        	}
        }
 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);
 }
        private void make_attributes_for_declaration(SyntaxTree.declaration td, definition_node ctn)
        {
            if (td.attributes != null)
            {
                Hashtable ht = new Hashtable();
                foreach (SyntaxTree.simple_attribute_list sal in td.attributes.attributes)
                    for (int j = 0; j < sal.attributes.Count; j++)
                    {
                        SyntaxTree.attribute attr = sal.attributes[j];
                        attribute_converted = true;
                        type_node tn = convert_strong(attr.type);
                        bool is_attr = false;
                        type_node tmp = tn;
                        while (tmp.base_type != null && !is_attr)
                        {
                            is_attr = tmp.base_type == SystemLibrary.SystemLibrary.attribute_type;
                            tmp = tmp.base_type;
                        }
                        if (!is_attr)
                            AddError(get_location(attr), "CLASS_{0}_NOT_ATTRIBUTE", tn.name);
                        bool allowMultiple = false;
                        AttributeTargets targets = get_usage_attrs(tn, out allowMultiple);
                        if (ht.Contains(tn) && !allowMultiple)
                        {
                            AddError(get_location(attr), "DUPLICATE_ATTRIBUTE_{0}_APPLICATION", tn.name);
                        }
                        else
                            ht[tn] = tn;
                        SemanticTree.attribute_qualifier_kind qualifier = SemanticTree.attribute_qualifier_kind.none_kind;
                        if (attr.qualifier != null)
                            if (j == 0)
                            {
                                if (string.Compare(attr.qualifier.name, "return", true) == 0)
                                {
                                    if (context.top_function == null)
                                        AddError(get_location(attr), "ATTRIBUTE_APPLICABLE_ONLY_TO_METHOD");
                                    if (context.top_function.return_value_type == null || context.top_function.return_value_type == SystemLibrary.SystemLibrary.void_type)
                                        AddError(get_location(attr), "EXPECTED_RETURN_VALUE_FOR_ATTRIBUTE");
                                    throw new NotSupportedError(get_location(attr.qualifier));
                                    qualifier = SemanticTree.attribute_qualifier_kind.return_kind;
                                }
                                else
                                    throw new NotSupportedError(get_location(attr.qualifier));
                            }
                            else
                                AddError(get_location(attr.qualifier), "ATTRIBUTE_QUALIFIER_MUST_BE_FIRST");
                        check_for_usage_attribute(ctn, targets, tn.name, get_location(attr), qualifier);

                        attribute_converted = false;
                        SyntaxTree.expression_list cnstr_args = new SyntaxTree.expression_list();
                        if (attr.arguments != null)
                        {
                            foreach (SyntaxTree.expression e in attr.arguments.expressions)
                            {
                                if (e is SyntaxTree.bin_expr && (e as SyntaxTree.bin_expr).operation_type == SyntaxTree.Operators.Equal
                                    && (e as SyntaxTree.bin_expr).left is SyntaxTree.ident)
                                {
                                    break;
                                }
                                else
                                {
                                    cnstr_args.expressions.Add(e);
                                }
                            }
                        }
                        expressions_list args = new expressions_list();
                        for (int i = 0; i < cnstr_args.expressions.Count; i++)
                        {
                            constant_node cn = convert_strong_to_constant_node(cnstr_args.expressions[i]);
                            check_for_strong_constant(cn, get_location(cnstr_args.expressions[i]));
                            args.AddElement(cn);
                        }

                        base_function_call bfc = create_constructor_call(tn, args, get_location(attr));
                        if (ctn is common_type_node && tn == SystemLibrary.SystemLibrary.struct_layout_attribute_type)
                        {
                            if ((System.Runtime.InteropServices.LayoutKind)Convert.ToInt32((args[0] as constant_node).get_object_value()) == System.Runtime.InteropServices.LayoutKind.Explicit)
                            {
                                check_all_fields_have_field_offset_attr(ctn as common_type_node);
                            }
                        }
                        attribute_node attr_node = new attribute_node(bfc.simple_function_node, tn, get_location(td));
                        foreach (expression_node en in bfc.parameters)
                        {
                            constant_node cn = convert_strong_to_constant_node(en, en.type);
                            check_for_strong_constant(cn, en.location);
                            attr_node.args.Add(cn);
                        }
                        if (attr.arguments != null)
                        {
                            for (int i = cnstr_args.expressions.Count; i < attr.arguments.expressions.Count; i++)
                            {
                                SyntaxTree.expression e = attr.arguments.expressions[i];
                                if (!(e is SyntaxTree.bin_expr && (e as SyntaxTree.bin_expr).operation_type == SyntaxTree.Operators.Equal
                                      && (e as SyntaxTree.bin_expr).left is SyntaxTree.ident))
                                {
                                    AddError(get_location(e), "EXPECTED_ATTRIBUTE_INITIALIZER");
                                }
                                else
                                {
                                    SyntaxTree.ident id = (e as SyntaxTree.bin_expr).left as SyntaxTree.ident;
                                    SymbolInfo si = tn.find_in_type(id.name);
                                    definition_node dn = context.check_name_node_type(id.name, si, get_location(id), general_node_type.property_node, general_node_type.variable_node);
                                    type_node mem_tn = null;
                                    if (dn is property_node)
                                    {
                                        property_node pn = dn as property_node;
                                        attr_node.prop_names.Add(pn);
                                        if (pn.set_function == null)
                                            AddError(new ThisPropertyCanNotBeWrited(pn, get_location(id)));
                                        if (pn.set_function.parameters.Count != 1)
                                            AddError(get_location(id), "INDEX_PROPERTY_INITIALIZING_NOT_VALID");
                                        mem_tn = pn.set_function.parameters[0].type;
                                    }
                                    else if (dn is var_definition_node)
                                    {
                                        attr_node.field_names.Add(dn as var_definition_node);
                                        mem_tn = (dn as var_definition_node).type;
                                    }
                                    else
                                    {
                                        throw new CompilerInternalError("Bad general node type for attribute initializer");
                                    }
                                    //SyntaxTree.assign tmp_ass = new SyntaxTree.assign(id,(e as SyntaxTree.bin_expr).right,SyntaxTree.Operators.Assignment);
                                    //tmp_ass.source_context = e.source_context;
                                    //basic_function_call tmp_bfc = convert_strong(tmp_ass) as basic_function_call;
                                    constant_node cn = convert_strong_to_constant_node((e as SyntaxTree.bin_expr).right, mem_tn);
                                    check_for_strong_constant(cn, get_location((e as SyntaxTree.bin_expr).right));
                                    if (dn is property_node)
                                        attr_node.prop_initializers.Add(cn);
                                    else
                                        attr_node.field_initializers.Add(cn);
                                }
                            }
                        }
                        attr_node.qualifier = qualifier;
                        ctn.attributes.AddElement(attr_node);
                    }
            }
        }
        //получения индекса в таблице интерфейсных имен
		private int GetNameIndex(definition_node dn)
		{
			return name_pool[dn].index;
		}
 internal addressed_expression create_variable_reference(definition_node dn, location lloc)
 {
     switch (dn.semantic_node_type)
     {
         case semantic_node_type.local_variable:
             {
                 local_variable lv = (local_variable)dn;
                 if (context.converting_block() == block_type.function_block)
                 {
                     return new local_variable_reference(lv,
                         convertion_data_and_alghoritms.symbol_table.GetRelativeScopeDepth(lv.function.scope, context.top_function.scope), lloc);
                 }
                 else if (context.converting_block() == block_type.namespace_block)
                 {
                     return new local_variable_reference(lv, 0, lloc);
                 }
                 else
                 {
                     throw new CompilerInternalError("Invalid block type");
                 }
             }
         case semantic_node_type.namespace_variable:
             {
                 namespace_variable nv = (namespace_variable)dn;
                 return new namespace_variable_reference(nv, lloc);
             }
         case semantic_node_type.class_field:
             {
                 class_field cf = (class_field)dn;
                 if (cf.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
                 {
                     return new static_class_field_reference(cf, lloc);
                 }
                 expression_node obj = GetCurrentObjectReference(cf.cont_type.Scope,cf, lloc); //new this_node(context.converted_type, lloc);
                 return new class_field_reference(cf, obj, lloc);
             }
         case semantic_node_type.common_parameter:
             {
                 if (context.in_parameters_block)
                     AddError(new ParameterReferenceInDefaultParameterNotAllowed(lloc));
                 common_parameter cpar = (common_parameter)dn;
                 return new common_parameter_reference(cpar,
                     convertion_data_and_alghoritms.symbol_table.GetRelativeScopeDepth(cpar.common_function.scope, context.top_function.scope), lloc);
             }
         case semantic_node_type.local_block_variable:
             {
                 return new local_block_variable_reference((local_block_variable)dn, lloc);
             }
     	case semantic_node_type.compiled_variable_definition:
     		{
     			return new static_compiled_variable_reference((compiled_variable_definition)dn,lloc);
     		}
         default: throw new NotSupportedError(lloc);
     }
     return null;
 }
        //сериализована ли сущность
		private bool IsDefined(definition_node dn)
		{
            return members.ContainsKey(dn);
		}
 void checkPolymorphicState(definition_node dn,location loc)
 {
 }
        //сохранить смещение сущности в таблицах и в списке интерфейсных имен
		private int SavePositionAndConstPool(definition_node dn)
		{
            int pos = (int)bw.BaseStream.Position;
            members[dn] = pos;
			name_pool[dn].offset = pos;
            if (dn is common_namespace_function_node)
                if ((dn as common_namespace_function_node).is_overload)
                    name_pool[dn].symbol_kind = symbol_kind.sk_overload_function;
			gl_members[dn] = pos;
            List<PCUWriter> pwl = null;
            //если какой-то модуль ждет смещения от этой сущности, сообщаем ему
            if (not_comp_members.TryGetValue(dn, out pwl))
                foreach(PCUWriter pw in pwl) 
            	pw.AddOffsetForMembers(dn, pos);
            PCUReader.AddReadOrWritedDefinitionNode(dn, pos);
            return pos;
		}
 internal expression_node GetCurrentObjectReference(SymbolTable.Scope scope, definition_node dn, location loc)
 {
     if (WithSection)
         if (scope != null)
             if (WithVariables.ContainsKey(scope))
                 return WithVariables[scope];
     		else
     if (WithTypes.Contains(scope))
     {
     	switch (dn.semantic_node_type)
     	{
     		case semantic_node_type.class_field : if (!(dn as class_field).IsStatic) AddError(new CanNotReferenceToNonStaticFieldWithType(dn as class_field,loc,null)); break;
     		case semantic_node_type.compiled_variable_definition : if (!(dn as compiled_variable_definition).IsStatic) AddError(new CanNotReferenceToNonStaticFieldWithType(dn as class_field,loc,null)); break;
     		case semantic_node_type.compiled_property_node:
     		case semantic_node_type.common_property_node : if ((dn as property_node).polymorphic_state != SemanticTree.polymorphic_state.ps_static) AddError(new CanNotReferenceToNonStaticPropertyWithType(dn as property_node,loc,null)); break;
     		case semantic_node_type.compiled_function_node:
     		case semantic_node_type.common_method_node:  if ((dn as function_node).polymorphic_state != SemanticTree.polymorphic_state.ps_static) AddError(new CanNotReferenceToNonStaticMethodWithType((dn as function_node).name,loc)); break;
     	}
     }
     if (context.inStaticArea())
     {
         AddError(new CanNotReferenceToNonStaticFromStatic(dn,loc));
         return null;
     }
     else
         return new this_node(context.converted_type, loc);
 }
 //(ssyy) сохраняем смещение сущности (для implementation)
 private int SavePositionAndImplementationPool(definition_node dn)
 {
     int pos = (int)bw.BaseStream.Position;
     members[dn] = pos;
     impl_name_pool[dn].offset = pos;
     gl_members[dn] = pos;
     return pos;
 }
        public SymbolInfo(namespace_variable value)
		{
			//_name_information_type=name_information_type.nit_namespace_variable;
			_sym_info=value;
			_access_level=access_level.al_public;
			_symbol_kind=symbol_kind.sk_none;
		}