示例#1
0
 public bounded_array_interface(ordinal_type_interface oti, type_node element_type,
                                common_property_node index_property, type_node index_type, class_field int_array)
 {
     _oti            = oti;
     _element_type   = element_type;
     _index_property = index_property;
     _index_type     = index_type;
     _int_array      = int_array;
 }
 private void visit_generic_params(common_type_node ctn, List<SyntaxTree.ident> idents)
 {
     if (SemanticRules.RuntimeInitVariablesOfGenericParameters)
     {
         if (SystemLibrary.SystemLibInitializer.RuntimeInitializeFunction != null)   // SSM 12/05/15 - из-за отсутствия этого падало при наличии обобщенных классов в системном модуле! Ужас!
             SystemLibrary.SystemLibInitializer.RuntimeInitializeFunction.Restore(); 
     }
     ctn.is_generic_type_definition = true;
     check_param_redeclared(idents);
     ctn.generic_params = new List<SemanticTree.ICommonTypeNode>();
     foreach (SyntaxTree.ident id in idents)
     {
         common_type_node par = new common_type_node(
             id.name, SemanticTree.type_access_level.tal_public, context.converted_namespace,
             convertion_data_and_alghoritms.symbol_table.CreateInterfaceScope(null, SystemLibrary.SystemLibrary.object_type.Scope, null),
             get_location(id));
         SystemLibrary.SystemLibrary.init_reference_type(par);
         par.SetBaseType(SystemLibrary.SystemLibrary.object_type);
         par.generic_type_container = ctn;
         ctn.generic_params.Add(par);
         ctn.scope.AddSymbol(id.name, new SymbolInfo(par));
         if (SemanticRules.RuntimeInitVariablesOfGenericParameters && !ctn.IsInterface && !ctn.IsDelegate)
         {
             class_field cf = new class_field(
                 compiler_string_consts.generic_param_kind_prefix + id.name,
                 SystemLibrary.SystemLibrary.byte_type,
                 ctn, PascalABCCompiler.SemanticTree.polymorphic_state.ps_static,
                 SemanticTree.field_access_level.fal_public, null);
             ctn.fields.AddElement(cf);
             par.runtime_initialization_marker = cf;
         }
     }
 }
示例#3
0
		public var_definition_node create_temp_variable(string name,type_node type,location loc)
		{
			var_definition_node vdn=null;
			switch (converting_block())
			{
				case block_type.function_block:
				{
                    common_function_node top_func = _func_stack.top();
					local_variable lv=new local_variable(name,type,top_func,loc);
					vdn=lv;
					top_func.var_definition_nodes_list.AddElement(lv);
					break;
				}
				case block_type.type_block:
				{
                    //TODO:сделать static и virtual.
					class_field cf=new class_field(name,type,_ctn,SemanticTree.polymorphic_state.ps_common,_fal,loc);
					vdn=cf;
					_ctn.fields.AddElement(cf);
					break;
				}
				case block_type.namespace_block:
				{
					namespace_variable nsv=new namespace_variable(name,type,_cmn,loc);
					vdn=nsv;
					_cmn.variables.AddElement(nsv);
					break;
				}
			}
			return vdn;
		}
 private definition_node CreateInterfaceClassField(string name, int offset)
 {
     definition_node dn = null;
     if (members.TryGetValue(offset, out dn))
         return dn as class_field;
     class_field field = null;
     int name_off = br.ReadInt32();
     type_node type = GetTypeReference();
     field = new class_field(name,type,null,SemanticTree.polymorphic_state.ps_common,SemanticTree.field_access_level.fal_internal,null);
     AddMember(field, offset);
     expression_node initv = null;
     if (CanReadObject())
         initv = CreateExpressionWithOffset();
     common_type_node cont = (common_type_node)GetTypeReference(br.ReadInt32());
     if (name==null)
         name = GetStringInClass(cont, name_off);
     SemanticTree.field_access_level fal = (SemanticTree.field_access_level)br.ReadByte();
     SemanticTree.polymorphic_state ps = (SemanticTree.polymorphic_state)br.ReadByte();
     attributes_list attrs = GetAttributes();
     location loc = ReadDebugInfo();
     field.name = name;
     field.attributes.AddRange(attrs);
     field.cont_type = cont;
     field.field_access_level = fal;
     field.polymorphic_state = ps;
     field.loc = loc;
    
     //field = new class_field(name,type,cont,ps,fal,loc);
     field.inital_value = initv;
     cont.fields.AddElement(field);
     //members[offset] = field;
     AddMember(field, offset);            
     return field;
 }
示例#5
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 common_event add_event_definition(string name, location loc, type_node tn, SemanticTree.polymorphic_state ps, bool is_abstract)
        {
            class_field cf = new class_field(name + "$", tn, converted_type, ps, _fal, loc);
            common_event ce = new common_event(name, tn, converted_type, null, null, null, _fal, ps, loc);
            //add
            common_method_node add_meth = new common_method_node(compiler_string_consts.GetAddHandler(name), null, this.converted_type,
                                                                 ps, SemanticTree.field_access_level.fal_public, null);
            common_parameter cp = new common_parameter("value", tn, SemanticTree.parameter_type.value, add_meth, concrete_parameter_type.cpt_none, null, null);
            add_meth.parameters.AddElement(cp);
            expression_node fld_ref = null;
            if (!cf.IsStatic) fld_ref = new class_field_reference(cf, new this_node(converted_type, null), null);
            else fld_ref = new static_class_field_reference(cf, null);
            expression_node en = this.syntax_tree_visitor.convertion_data_and_alghoritms.type_constructor.delegate_add_assign_compile_time_executor
                (null, new expression_node[2] { fld_ref, new common_parameter_reference(cp, 0, null) });

            if (!is_abstract)
            {
                add_meth.function_code = new statements_list(null);
                (add_meth.function_code as statements_list).statements.AddElement(en);
            }
            converted_type.scope.AddSymbol(add_meth.name, new SymbolInfo(add_meth));
            //remove
            common_method_node remove_meth = new common_method_node(compiler_string_consts.GetRemoveHandler(name), null, this.converted_type,
                                                                 ps, SemanticTree.field_access_level.fal_public, null);

            cp = new common_parameter("value", tn, SemanticTree.parameter_type.value, add_meth, concrete_parameter_type.cpt_none, null, null);
            remove_meth.parameters.AddElement(cp);
            en = this.syntax_tree_visitor.convertion_data_and_alghoritms.type_constructor.delegate_sub_assign_compile_time_executor
                (null, new expression_node[2] { fld_ref, new common_parameter_reference(cp, 0, null) });
            if (!is_abstract)
            {
                remove_meth.function_code = new statements_list(null);
                (remove_meth.function_code as statements_list).statements.AddElement(en);
            }
            converted_type.scope.AddSymbol(remove_meth.name, new SymbolInfo(remove_meth));
            this.converted_type.methods.AddElement(add_meth);
            this.converted_type.methods.AddElement(remove_meth);
            ce.set_add_method(add_meth);
            ce.set_remove_method(remove_meth);
            ce.field = cf;
            this.converted_type.events.AddElement(ce);
            if (!is_abstract)
                this.converted_type.fields.AddElement(cf);
            converted_type.scope.AddSymbol(name, new SymbolInfo(ce));
            return ce;
        }
示例#7
0
 public void AddField(class_field fld)
 {
     FldInfo vi = new FldInfo();
     ht[fld] = vi;
 }
		private void WriteFieldReference(class_field field)
		{
            generic_instance_type_node gitn = field.cont_type as generic_instance_type_node;
            if (gitn != null)
            {
                bw.Write(PCUConsts.generic_field);
                WriteGenericTypeInstance(gitn);
                if (gitn is compiled_generic_instance_type_node)
                {
                    WriteCompiledVariable(
                        gitn.get_member_definition(field) as compiled_variable_definition
                        );
                }
                else
                {
                    WriteFieldReference(gitn.get_member_definition(field) as class_field);
                }
                return;
            }
            common_type_node ctnode = field.comperehensive_type as common_type_node;
            if (ctnode != null && ctnode.original_template != null)
            {
                bw.Write(PCUConsts.template_field); //т.е. пишем на место is_def
                WriteTemplateInstance(ctnode);
                bw.Write(ctnode.fields.IndexOf(field));
                return;
            }

            byte is_def = 0;
			int offset = GetFieldReference(field, ref is_def);
			bw.Write(is_def);
			bw.Write(offset);
		}
 public class_field_reference(class_field field, expression_node obj, location loc) :
     base(field.type, loc)
 {
     _field = field;
     _obj   = obj;
 }
        /*
		public static_class_field_reference(class_field static_field,common_type_node type,location loc) :
			base(static_field.type,loc)
		{
			_field=static_field;
			_type=type;
		}
        */

		public static_class_field_reference(class_field static_field,location loc) :
			base(static_field.type,loc)
		{
			_field=static_field;
			_type=static_field.cont_type;
		}
		public class_field_reference(class_field field,expression_node obj,location loc) :
			base(field.type,loc)
		{
			_field=field;
			_obj=obj;
		}
 public bounded_array_interface(ordinal_type_interface oti, type_node element_type,
     common_property_node index_property, type_node index_type, class_field int_array)
 {
     _oti = oti;
     _element_type = element_type;
     _index_property = index_property;
     _index_type = index_type;
     _int_array = int_array;
 }
		public var_definition_node add_var_definition(string name, location loc, type_node tn, SemanticTree.polymorphic_state ps)
		{
			check_name_free(name,loc);
			var_definition_node vdn=null;
            if (CurrentScope is SymbolTable.BlockScope)
            {
                if (SemanticRules.DisabledDefinitionBlockVariablesWithSameNameThatInAboveScope)
                {
                    SymbolTable.Scope cs = CurrentScope;
                    while (cs.TopScope != null /*(cs.TopScope is SymbolTable.BlockScope || cs.TopScope is SymbolTable.UnitPartScope)*/)
                    {
                    	if (cs.TopScope is SymbolTable.BlockScope)//projdemsja po blokam koda
                    	{
                    		if (cs.TopScope.FindOnlyInScope(name) != null)
                                syntax_tree_visitor.AddError(loc, "BLOCK_VARIABLES_CANNOT_HAVE_NAMES_UPPER_SCOPE");
                    		cs = cs.TopScope;
                    	}
                    	else // a zdes proverjaem v verhnem bloke i vse, to chto eshe vyshe, tam ne proverjaem, tak dejstvuet princip blochnosti
                    	{
                    		if (cs.TopScope.FindOnlyInScope(name) != null)
                                syntax_tree_visitor.AddError(loc, "BLOCK_VARIABLES_CANNOT_HAVE_NAMES_UPPER_SCOPE");
                    		break;
                    	}
                        
                    }
                }
            	local_block_variable lv = new local_block_variable(name, tn, CurrentStatementList, loc);
                CurrentScope.AddSymbol(name, new SymbolInfo(lv));
                lv.block.local_variables.Add(lv);
                if (tn == null) //Тип еще неизвестен, будем закрывать.
                    var_defs.Add(lv);
                return lv;
            }
            switch (converting_block())
			{
				case block_type.function_block:
				{
                    common_function_node top_func = _func_stack.top();
					local_variable lv=new local_variable(name,tn,top_func,loc);
					vdn=lv;
					top_func.var_definition_nodes_list.AddElement(lv);
                    CurrentScope.AddSymbol(name, new SymbolInfo(lv));
					//top_func.scope.AddSymbol(name,new SymbolInfo(lv));
					break;
				}
				case block_type.type_block:
				{
                    //TODO:сделать static и virtual.
                    class_field cf = new class_field(name,tn, _ctn, ps,_fal,loc);
					vdn=cf;
					//_ctn.Scope.AddSymbol(name,new SymbolInfo(cf));
                    CurrentScope.AddSymbol(name, new SymbolInfo(cf));
					_ctn.fields.AddElement(cf);
					break;
				}
				case block_type.namespace_block:
				{
					namespace_variable nsv=new namespace_variable(name,tn,_cmn,loc);
					vdn=nsv;
					//_cmn.scope.AddSymbol(name,new SymbolInfo(nsv));
                    CurrentScope.AddSymbol(name, new SymbolInfo(nsv));
					_cmn.variables.AddElement(nsv);
					break;
				}
			}
            if (tn == null) //Тип еще неизвестен, будем закрывать.
                var_defs.Add(vdn);
            return vdn;
		}
 public var_definition_node add_field(string name, location loc, type_node tn, SemanticTree.polymorphic_state ps)
 {
     class_field cf = new class_field(name, tn, _ctn, ps, _fal, loc);
     //_ctn.Scope.AddSymbol(name,new SymbolInfo(cf));
     CurrentScope.AddSymbol(name, new SymbolInfo(cf));
     _ctn.fields.AddElement(cf);
     return cf;
 }
 internal function_node GenerateGetMethodForField(common_property_node cpn, string AcessorName, class_field cf, location loc)
 {
     SymbolInfo exist_si = context.find_only_in_namespace(AcessorName);
     if (exist_si != null && exist_si.sym_info.general_node_type != general_node_type.function_node)
     {
         AddError(loc, "CAN_NOT_GENERATE_ACCESSOR_{0}", AcessorName);
     }
     while (exist_si != null)
     {
         if (((function_node)(exist_si.sym_info)).parameters.Count == 0)
         {
             AddError(loc, "CAN_NOT_GENERATE_ACCESSOR_{0}", AcessorName);
         }
         exist_si = exist_si.Next;
     }
     common_method_node cmn = new common_method_node(
         AcessorName, loc, cf.cont_type,
         cf.polymorphic_state, context.get_field_access_level(), null);
     cpn.common_comprehensive_type.methods.AddElement(cmn);
     cmn.return_value_type = cf.type;
     cmn.is_overload = true;
     expression_node var_ref;
     if (cf.polymorphic_state == SemanticTree.polymorphic_state.ps_common)
     {
         var_ref = new class_field_reference(cf, new this_node(cf.type, loc), loc);
     }
     else
     {
         var_ref = new static_class_field_reference(cf, loc);
     }
     cmn.function_code = new return_node(var_ref, loc);
     cf.cont_type.scope.AddSymbol(AcessorName, new SymbolInfo(cmn));
     return cmn;
 }
        /*
         *      public static_class_field_reference(class_field static_field,common_type_node type,location loc) :
         *              base(static_field.type,loc)
         *      {
         *              _field=static_field;
         *              _type=type;
         *      }
         */

        public static_class_field_reference(class_field static_field, location loc) :
            base(static_field.type, loc)
        {
            _field = static_field;
            _type  = static_field.cont_type;
        }
		private int GetFieldReference(class_field field, ref byte is_def)
		{
            int off = 0;
            if (members.TryGetValue(field, out off)) //если этот тип описан в этом модуле
            {
                is_def = 1;
                return off;//возвращаем его смещение
            }
			is_def = 0;
            ImportedEntity ie = null;
            if (ext_members.TryGetValue(field, out ie))
            {
                return ie.index * ie.GetSize();
            }
			ie = new ImportedEntity();
			ie.flag = ImportKind.Common;
			ie.num_unit = GetExtTypeReference(field.cont_type);
			ie.offset = GetExternalOffset(field);
			int offset = imp_entitles.Count*ie.GetSize();
            ie.index = imp_entitles.Count;
            imp_entitles.Add(ie);
			ext_members[field] = ie;
			return offset;
		}
		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;
		}
		private void VisitFieldDefinition(class_field field, int offset)
		{
            SavePositionAndConstPool(field);
			bw.Write((byte)field.semantic_node_type);
			bw.Write(GetNameIndex(field));
			WriteTypeReference(field.type);
            if (CanWriteObject(field.inital_value))
            {
            	SaveExpressionAndOffset(field.inital_value);
            	bw.Write(0);
            	//VisitExpression(field.inital_value);
            }
			bw.Write(offset);//comprehensive type
			bw.Write((byte)field.field_access_level);
			bw.Write((byte)field.polymorphic_state);
			SaveOffsetForAttribute(field);
            bw.Write(0);//attributes;
			WriteDebugInfo(field.loc);
		}
示例#20
0
		private void SaveField(class_field cfn)
		{
			if (!string.IsNullOrEmpty(cfn.documentation))
			{
				if (!cfn.documentation.Trim(' ','\t').StartsWith("<summary>"))
				{
					xtw.WriteStartElement("member");
					xtw.WriteStartAttribute("name");
					if (is_assembly)
						xtw.WriteString("F:"+get_name(cfn.cont_type)+"."+cfn.name);
					else
						xtw.WriteString("F:"+cfn.cont_type.name+"."+cfn.name);
					xtw.WriteEndAttribute();
					xtw.WriteStartElement("summary");
					xtw.WriteString(cfn.documentation);
					xtw.WriteEndElement();
					xtw.WriteEndElement();
				}
				else 
				{
					string doc = string.Concat("<member name=\""+(is_assembly?("F:"+get_name(cfn.cont_type)+"."+cfn.name):("F:"+cfn.cont_type.name+"."+cfn.name))+"\">",cfn.documentation,"</member>");
					StringReader sr = new StringReader(doc);
					XmlReader xr = XmlTextReader.Create(sr);
					xr.Read();
					xtw.WriteNode(xr.ReadSubtree(),false);
					sr.Close();
					xr.Close();
				}
			}
		}
示例#21
0
 public FldInfo GetField(class_field fld)
 {
     return (FldInfo)ht[fld];
 }
示例#22
0
		private type_node create_array_type(ordinal_type_interface oti_indexer, type_node element_type,common_namespace_node _cmn, location loc)
		{
			int arr_length = oti_indexer.ordinal_type_to_int(oti_indexer.upper_value) -
				oti_indexer.ordinal_type_to_int(oti_indexer.lower_value) + 1;

			if (arr_length <= 0)
			{
				throw new SimpleSemanticError(loc, "NEGATIVE_ARRAY_LENGTH_({0})_NOT_ALLOWED", arr_length);
			}

			simple_array sa = new simple_array(element_type, arr_length);
			//sa.length = arr_length;
			//sa.element_type = element_type;

			SymbolTable.Scope top_scope = null;
			if (_cmn != null)
			{
				top_scope = _cmn.scope;
			}
			string name = get_pascal_array_name();
			//if (_cmn.namespace_name != null)
			//    name = _cmn.namespace_name + name;
			common_type_node ctn = new common_type_node(null, name, SemanticTree.type_access_level.tal_public,
			                                            _cmn, convertion_data_and_alghoritms.symbol_table.CreateClassScope(top_scope, null), loc);

			ctn.SetBaseType(SystemLibrary.SystemLibrary.object_type);
			//DarkStar Add
			//loc не нужно мне это!  и некому не нужно!
			//loc = null;
			
			//ctn.internal_is_value = true;

			class_constant_definition cdn1 = new class_constant_definition(compiler_string_consts.lower_array_const_name,
			                                                               oti_indexer.lower_value, loc, ctn, SemanticTree.field_access_level.fal_public);
			ctn.scope.AddSymbol(cdn1.name, new SymbolInfo(cdn1));

			class_constant_definition cdn2 = new class_constant_definition(compiler_string_consts.upper_array_const_name,
			                                                               oti_indexer.upper_value, loc, ctn, SemanticTree.field_access_level.fal_public);
			ctn.scope.AddSymbol(cdn2.name, new SymbolInfo(cdn2));

			class_field int_arr = new class_field(compiler_string_consts.internal_array_name, sa, ctn,
			                                      SemanticTree.polymorphic_state.ps_common, SemanticTree.field_access_level.fal_public,loc);
			ctn.scope.AddSymbol(int_arr.name, new SymbolInfo(int_arr));
			ctn.fields.AddElement(int_arr);

			SystemLibrary.SystemLibrary.init_reference_type(ctn);

			ctn.const_defs.AddElement(cdn1);
			ctn.const_defs.AddElement(cdn2);

			common_method_node get_func = new common_method_node(compiler_string_consts.get_val_pascal_array_name,
			                                                     element_type, /*loc*/new location(0xFFFFFF, 0, 0xFFFFFF, 0, loc.doc), ctn, SemanticTree.polymorphic_state.ps_common, SemanticTree.field_access_level.fal_private,
			                                                     convertion_data_and_alghoritms.symbol_table.CreateScope(ctn.scope));
			common_parameter get_param = new common_parameter(compiler_string_consts.unary_param_name,
			                                                  oti_indexer.lower_value.type, SemanticTree.parameter_type.value, get_func, concrete_parameter_type.cpt_none,
			                                                  null, loc);
			get_func.parameters.AddElement(get_param);

			common_parameter_reference cpr = new common_parameter_reference(get_param, 0, loc);
			expression_node en1 = convertion_data_and_alghoritms.create_simple_function_call(oti_indexer.value_to_int,
			                                                                                 loc, cpr);
			expression_node en2 = new int_const_node(oti_indexer.ordinal_type_to_int(oti_indexer.lower_value), loc);
			expression_node sub_expr = convertion_data_and_alghoritms.create_simple_function_call(
				SystemLibrary.SystemLibrary.int_sub, loc, en1, en2);

			this_node thisnode = new this_node(ctn, loc);

			class_field_reference cfr1 = new class_field_reference(int_arr, thisnode, loc);

			expression_node index_expr = new simple_array_indexing(cfr1, sub_expr, element_type, loc);

			statement_node sn = new return_node(index_expr, /*loc*/new location(0xFFFFFF, 0, 0xFFFFFF, 0, loc.doc));

			get_func.function_code = sn;

			common_method_node set_func = new common_method_node(compiler_string_consts.set_val_pascal_array_name,
			                                                     null, /*loc*/new location(0xFFFFFF, 0, 0xFFFFFF, 0, loc.doc), ctn, SemanticTree.polymorphic_state.ps_common, SemanticTree.field_access_level.fal_private,
			                                                     convertion_data_and_alghoritms.symbol_table.CreateScope(ctn.scope));
			common_parameter set_ind = new common_parameter(compiler_string_consts.left_param_name,
			                                                oti_indexer.lower_value.type, SemanticTree.parameter_type.value, set_func, concrete_parameter_type.cpt_none,
			                                                null, loc);
			set_func.parameters.AddElement(set_ind);
			common_parameter set_val = new common_parameter(compiler_string_consts.right_param_name,
			                                                element_type, SemanticTree.parameter_type.value, set_func, concrete_parameter_type.cpt_none, null, loc);
			set_func.parameters.AddElement(set_val);

			common_parameter_reference cpr2 = new common_parameter_reference(set_ind, 0, loc);
			expression_node en3 = convertion_data_and_alghoritms.create_simple_function_call(oti_indexer.value_to_int,
			                                                                                 loc, cpr2);
			expression_node en4 = new int_const_node(oti_indexer.ordinal_type_to_int(oti_indexer.lower_value), loc);
			expression_node sub_expr2 = convertion_data_and_alghoritms.create_simple_function_call(
				SystemLibrary.SystemLibrary.int_sub, loc, en3, en4);

			class_field_reference cfr2 = new class_field_reference(int_arr, thisnode, loc);

			expression_node index_expr2 = new simple_array_indexing(cfr2, sub_expr2, element_type,loc);

			SymbolInfo si = element_type.find_in_type(compiler_string_consts.assign_name);
			if (si == null)
			{
				throw new NotSupportedError(loc);
				throw new CompilerInternalError("Varable of this type can not be assigned");
			}
			if (si.sym_info.general_node_type != general_node_type.function_node)
			{
				throw new CompilerInternalError("Invalid assign operator");
			}

			expression_node val_ref = new common_parameter_reference(set_val, 0, loc);

			function_node assign = (function_node)si.sym_info;
			statement_node assign_call = convertion_data_and_alghoritms.create_simple_function_call(assign,
			                                                                                        /*loc*/new location(0xFFFFFF, 0, 0xFFFFFF, 0, loc.doc), index_expr2, val_ref);

			set_func.function_code = assign_call;

			ctn.methods.AddElement(get_func);
			ctn.methods.AddElement(set_func);

			common_property_node cpn = new common_property_node(compiler_string_consts.index_property_pascal_array_name,
			                                                    ctn, element_type, get_func, set_func, loc, SemanticTree.field_access_level.fal_public, SemanticTree.polymorphic_state.ps_common);

			common_parameter prop_cp = new common_parameter(compiler_string_consts.unary_param_name, oti_indexer.lower_value.type,
			                                                SemanticTree.parameter_type.value, null, concrete_parameter_type.cpt_none, null, loc);
			cpn.parameters.AddElement(prop_cp);

			ctn.properties.AddElement(cpn);

			ctn.default_property = cpn;

			if (_cmn != null)
			{
				_cmn.types.AddElement(ctn);
			}

			bounded_array_interface bai = new bounded_array_interface(oti_indexer, element_type, cpn, oti_indexer.lower_value.type, int_arr);
			ctn.add_internal_interface(bai);
			ctn.type_special_kind = SemanticTree.type_special_kind.array_wrapper;

            if (element_type.type_special_kind != SemanticTree.type_special_kind.array_wrapper)
            {
                ctn.ImplementingInterfaces.Add(compiled_type_node.get_type_node(NetHelper.NetHelper.FindType(compiler_string_consts.IEnumerableInterfaceName)));
                common_method_node en_cmn = new common_method_node(compiler_string_consts.GetEnumeratorMethodName, compiled_type_node.get_type_node(NetHelper.NetHelper.FindType(compiler_string_consts.IEnumeratorInterfaceName)), null, ctn, SemanticTree.polymorphic_state.ps_virtual, SemanticTree.field_access_level.fal_public, null);

                compiled_function_node en_fnc = NetHelper.NetHelper.FindName(NetHelper.NetHelper.FindType(compiler_string_consts.IEnumerableInterfaceName), compiler_string_consts.GetEnumeratorMethodName).sym_info as compiled_function_node;
                statements_list sl = new statements_list(null);
                sl.statements.AddElement(new return_node(
                    new compiled_function_call(en_fnc, new class_field_reference(int_arr, new this_node(ctn, null), null), null), null));
                en_cmn.function_code = sl;
                en_cmn.newslot_awaited = true;
                ctn.methods.AddElement(en_cmn);

                if (!element_type.IsPointer)
                {
                    List<type_node> generic_args = new List<type_node>();
                    generic_args.Add(element_type);
                    type_node en_tn = compiled_type_node.get_type_node(NetHelper.NetHelper.FindType(compiler_string_consts.IGenericEnumerableInterfaceName)).get_instance(generic_args);
                    ctn.ImplementingInterfaces.Add(en_tn);

                    en_cmn = new common_method_node(compiler_string_consts.GetEnumeratorMethodName, compiled_type_node.get_type_node(NetHelper.NetHelper.FindType(compiler_string_consts.IGenericEnumeratorInterfaceName)).get_instance(generic_args), null, ctn, SemanticTree.polymorphic_state.ps_virtual, SemanticTree.field_access_level.fal_public, null);
                    //en_fnc = en_tn.find_in_type("GetEnumerator").sym_info as function_node;//NetHelper.NetHelper.FindName(NetHelper.NetHelper.FindType(compiler_string_consts.IGenericEnumerableInterfaceName), compiler_string_consts.GetEnumeratorMethodName).sym_info as compiled_function_node;
                    SymbolInfo en_si = en_tn.find_in_type("GetEnumerator");
                    if (en_si.Next != null && (en_si.Next.sym_info as function_node).return_value_type.is_generic_type_instance)
                        en_si = en_si.Next;
                    function_node en_fnc_inst = en_si.sym_info as function_node; ;//.get_instance(generic_args, true, loc);
                    sl = new statements_list(null);
                    if (en_fnc_inst is compiled_function_node)
                        sl.statements.AddElement(new return_node(
                            new compiled_function_call(en_fnc_inst as compiled_function_node, new class_field_reference(int_arr, new this_node(ctn, null), null), null), null));
                    else
                        sl.statements.AddElement(new return_node(
                            new common_method_call(en_fnc_inst as common_method_node, new class_field_reference(int_arr, new this_node(ctn, null), null), null), null));
                    en_cmn.function_code = sl;
                    en_cmn.newslot_awaited = true;
                    ctn.methods.AddElement(en_cmn);
                }
            }
			
			//= operation
			SymbolTable.ClassMethodScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope(_cmn.scope,ctn.scope);
        	common_method_node cmn_eq = new common_method_node(compiler_string_consts.GetNETOperName(compiler_string_consts.eq_name),SystemLibrary.SystemLibrary.bool_type,null,ctn,
        	                                                SemanticTree.polymorphic_state.ps_static,SemanticTree.field_access_level.fal_public,scope);
        	cmn_eq.IsOperator = true;
        	common_parameter prm1 = new common_parameter("a",ctn,SemanticTree.parameter_type.value,cmn_eq,concrete_parameter_type.cpt_none,null,null);
        	common_parameter prm2 = new common_parameter("b",ctn,SemanticTree.parameter_type.value,cmn_eq,concrete_parameter_type.cpt_none,null,null);
        	cmn_eq.parameters.AddElement(prm1);
        	cmn_eq.parameters.AddElement(prm2);
        	statements_list body = new statements_list(null);
        	local_variable vdn = new local_variable("$i",SystemLibrary.SystemLibrary.integer_type,cmn_eq,null);//this.convertion_data_and_alghoritms.syntax_tree_visitor.context.create_for_temp_variable(SystemLibrary.SystemLibrary.integer_type, null);
        	cmn_eq.var_definition_nodes_list.AddElement(vdn);
        	expression_node var_ref = new local_variable_reference(vdn,0,null);//this.convertion_data_and_alghoritms.syntax_tree_visitor.create_variable_reference(vdn,null);
        	basic_function_call cond = new basic_function_call(SystemLibrary.SystemLibrary.int_sm as basic_function_node,null);
        	cond.parameters.AddElement(var_ref);
        	cond.parameters.AddElement(new int_const_node(arr_length,null));
        	while_node while_stmt = new while_node(cond,null);
        	statements_list while_body = new statements_list(null);
        	while_stmt.body = while_body;
        	simple_array_indexing left_sar = new simple_array_indexing(new class_field_reference(int_arr, new common_parameter_reference(prm1,0,null), null),var_ref,element_type,null);
        	simple_array_indexing right_sar = new simple_array_indexing(new class_field_reference(int_arr, new common_parameter_reference(prm2,0,null), null),var_ref,element_type,null);
        	expression_node cond2 = SystemLibrary.SystemLibrary.syn_visitor.find_operator(compiler_string_consts.noteq_name,
        		                                                                            left_sar,right_sar,null);
        	if_node if_stmt = new if_node(cond2,new return_node(new bool_const_node(false,null),null),null,null);
        	while_body.statements.AddElement(if_stmt);
        	while_body.statements.AddElement(new basic_function_call(SystemLibrary.SystemLibrary.int_assign as basic_function_node,null
        	                                                   ,var_ref,new basic_function_call(SystemLibrary.SystemLibrary.int_add as basic_function_node,null,var_ref,new int_const_node(1,null))));
        	
        	body.statements.AddElement(while_stmt);
        	body.statements.AddElement(new return_node(new bool_const_node(true,null),null));
        	cmn_eq.function_code = body;
        	cmn_eq.is_overload = true;
        	ctn.methods.AddElement(cmn_eq);
        	ctn.Scope.AddSymbol(compiler_string_consts.eq_name,new SymbolInfo(cmn_eq));
        	
        	//<> operation
			scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope(_cmn.scope,ctn.scope);
        	common_method_node cmn_noteq = new common_method_node(compiler_string_consts.GetNETOperName(compiler_string_consts.noteq_name),SystemLibrary.SystemLibrary.bool_type,null,ctn,
        	                                                SemanticTree.polymorphic_state.ps_static,SemanticTree.field_access_level.fal_public,scope);
        	cmn_noteq.IsOperator = true;
        	prm1 = new common_parameter("a",ctn,SemanticTree.parameter_type.value,cmn_noteq,concrete_parameter_type.cpt_none,null,null);
        	prm2 = new common_parameter("b",ctn,SemanticTree.parameter_type.value,cmn_noteq,concrete_parameter_type.cpt_none,null,null);
        	cmn_noteq.parameters.AddElement(prm1);
        	cmn_noteq.parameters.AddElement(prm2);
        	body = new statements_list(null);
        	vdn = new local_variable("$i",SystemLibrary.SystemLibrary.integer_type,cmn_noteq,null);//this.convertion_data_and_alghoritms.syntax_tree_visitor.context.create_for_temp_variable(SystemLibrary.SystemLibrary.integer_type, null);
        	cmn_noteq.var_definition_nodes_list.AddElement(vdn);
        	var_ref = new local_variable_reference(vdn,0,null);//this.convertion_data_and_alghoritms.syntax_tree_visitor.create_variable_reference(vdn,null);
        	cond = new basic_function_call(SystemLibrary.SystemLibrary.int_sm as basic_function_node,null);
        	cond.parameters.AddElement(var_ref);
        	cond.parameters.AddElement(new int_const_node(arr_length,null));
        	while_stmt = new while_node(cond,null);
        	while_body = new statements_list(null);
        	while_stmt.body = while_body;
        	left_sar = new simple_array_indexing(new class_field_reference(int_arr, new common_parameter_reference(prm1,0,null), null),var_ref,element_type,null);
        	right_sar = new simple_array_indexing(new class_field_reference(int_arr, new common_parameter_reference(prm2,0,null), null),var_ref,element_type,null);
        	cond2 = SystemLibrary.SystemLibrary.syn_visitor.find_operator(compiler_string_consts.noteq_name,
        		                                                                            left_sar,right_sar,null);
        	if_stmt = new if_node(cond2,new return_node(new bool_const_node(true,null),null),null,null);
        	while_body.statements.AddElement(if_stmt);
        	while_body.statements.AddElement(new basic_function_call(SystemLibrary.SystemLibrary.int_assign as basic_function_node,null
        	                                                   ,var_ref,new basic_function_call(SystemLibrary.SystemLibrary.int_add as basic_function_node,null,var_ref,new int_const_node(1,null))));
        	
        	body.statements.AddElement(while_stmt);
        	body.statements.AddElement(new return_node(new bool_const_node(false,null),null));
        	cmn_noteq.function_code = body;
        	cmn_noteq.is_overload = true;
        	ctn.methods.AddElement(cmn_noteq);
        	ctn.Scope.AddSymbol(compiler_string_consts.noteq_name,new SymbolInfo(cmn_noteq));
        	
        	//Equals
        	/*scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope(_cmn.scope,ctn.scope);
        	common_method_node cmn_equals = new common_method_node("Equals",SystemLibrary.SystemLibrary.bool_type,null,ctn,
        	                                                SemanticTree.polymorphic_state.ps_virtual,SemanticTree.field_access_level.fal_public,scope);
        	prm1 = new common_parameter("a",SystemLibrary.SystemLibrary.object_type,SemanticTree.parameter_type.value,cmn_equals,concrete_parameter_type.cpt_none,null,null);
        	
        	cmn_equals.parameters.AddElement(prm1);
        	body = new statements_list(null);
        	vdn = new local_variable("$i",ctn,cmn_equals,null);//this.convertion_data_and_alghoritms.syntax_tree_visitor.context.create_for_temp_variable(SystemLibrary.SystemLibrary.integer_type, null);
        	cmn_equals.var_definition_nodes_list.AddElement(vdn);
        	var_ref = new local_variable_reference(vdn,0,null);//this.convertion_data_and_alghoritms.syntax_tree_visitor.create_variable_reference(vdn,null);
        	as_node _as = new as_node(new common_parameter_reference(prm1,0,null),ctn,null);
        	base_function_call ass_bfc = new basic_function_call(SystemLibrary.SystemLibrary.object_type.find(compiler_string_consts.assign_name).sym_info as basic_function_node,null);
        	ass_bfc.parameters.AddElement(var_ref);
        	ass_bfc.parameters.AddElement(_as);
        	body.statements.AddElement(ass_bfc);
        	common_static_method_call csmc = new common_static_method_call(ctn.find_in_type(compiler_string_consts.eq_name).sym_info as common_method_node,null);
        	csmc.parameters.AddElement(new this_node(ctn,null));
        	csmc.parameters.AddElement(var_ref);
        	body.statements.AddElement(new return_node(csmc,null));
        	ctn.methods.AddElement(cmn_equals);
        	ctn.Scope.AddSymbol("Equals",new SymbolInfo(cmn_equals));*/
        	return ctn;
		}