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


C# common_type_node.SetBaseType方法代码示例

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


在下文中一共展示了common_type_node.SetBaseType方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: add_generic_eliminations

 //Добавляет ограничители для параметра шаблона
 private void add_generic_eliminations(common_type_node param, List<SyntaxTree.type_definition> specificators)
 {
     Hashtable used_interfs = new Hashtable();
     for (int i = 0; i < specificators.Count; ++i)
     {
         SyntaxTree.declaration_specificator ds = specificators[i] as SyntaxTree.declaration_specificator;
         if (ds != null)
         {
             switch (ds.specificator)
             {
                 case SyntaxTree.DeclarationSpecificator.WhereDefClass:
                     if (i == 0)
                     {
                         param.is_class = true;
                     }
                     else
                     {
                         AddError(get_location(specificators[i]), "CLASS_OR_RECORD_SPECIFICATOR_MUST_BE_FIRST");
                     }
                     break;
                 case SyntaxTree.DeclarationSpecificator.WhereDefValueType:
                     if (i == 0)
                     {
                         param.internal_is_value = true;
                     }
                     else
                     {
                         AddError(get_location(specificators[i]), "CLASS_OR_RECORD_SPECIFICATOR_MUST_BE_FIRST");
                     }
                     break;
                 case SyntaxTree.DeclarationSpecificator.WhereDefConstructor:
                     if (i == specificators.Count - 1)
                     {
                         generic_parameter_eliminations.add_default_ctor(param);
                         //common_method_node cnode = new common_method_node(
                         //    compiler_string_consts.default_constructor_name, param, null,
                         //    param, SemanticTree.polymorphic_state.ps_common,
                         //    SemanticTree.field_access_level.fal_public, null);
                         //cnode.is_constructor = true;
                         //param.methods.AddElement(cnode);
                         //param.add_name(compiler_string_consts.default_constructor_name, new SymbolInfo(cnode));
                     }
                     else
                     {
                         AddError(get_location(specificators[i]), "CONSTRUCTOR_SPECIFICATOR_MUST_BE_LAST");
                     }
                     break;
             }
         }
         else
         {
             SyntaxTree.named_type_reference ntr = specificators[i] as SyntaxTree.named_type_reference;
             if (ntr == null)
             {
                 AddError(get_location(specificators[i]), "SPECIFICATOR_MUST_BE_TYPE_REFERENCE");
             }
             else
             {
                 type_node spec_type = ret.visit(ntr);
                 if (spec_type is ref_type_node || spec_type == SystemLibrary.SystemLibrary.void_type || spec_type == SystemLibrary.SystemLibrary.pointer_type)
                     ErrorsList.Add(new SimpleSemanticError(get_location(specificators[i]), "INAVLID_TYPE"));
                 if (spec_type.IsInterface)
                 {
                     if (used_interfs[spec_type] != null)
                     {
                         AddError(get_location(specificators[i]), "INTERFACE_{0}_ALREADY_ADDED_TO_IMPLEMENTING_LIST", spec_type.PrintableName);
                     }
                     else
                     {
                         used_interfs.Add(spec_type, spec_type);
                     }
                     //Добавляем интерфейс
                     type_table.AddInterface(param, spec_type, get_location(specificators[i]));
                 }
                 else
                 {
                     if (i != 0)
                     {
                         AddError(get_location(specificators[i]), "PARENT_SPECIFICATOR_MUST_BE_FIRST");
                     }
                     else
                     {
                         //Тип-предок
                         if (spec_type == SystemLibrary.SystemLibrary.object_type)
                         {
                             AddError(get_location(specificators[i]), "OBJECT_CAN_NOT_BE_USED_AS_PARENT_SPECIFICATOR");
                         }
                         if (spec_type == SystemLibrary.SystemLibrary.enum_base_type)
                         {
                             AddError(get_location(specificators[i]), "ENUM_CAN_NOT_BE_USED_AS_PARENT_SPECIFICATOR");
                         }
                         check_cycle_inheritance(param, spec_type);
                         param.SetBaseType(spec_type);
                     }
                 }
             }
         }
     }
     InitInterfaceScope(param);
//.........这里部分代码省略.........
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:101,代码来源:syntax_tree_visitor.cs

示例2: create_record_type

 public common_type_node create_record_type(location def_loc)
 {
     SymbolTable.ClassScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassScope(_cmn.scope, null);
     string name = "$record$" + rec_num++;
     common_type_node tctn = new common_type_node(name, SemanticTree.type_access_level.tal_public, _cmn,
         scope, def_loc);
     set_field_access_level(SemanticTree.field_access_level.fal_public);
     //_cmn.scope.AddSymbol(name, new SymbolInfo(tctn));
     tctn.SetBaseType(compiled_type_node.get_type_node(typeof(ValueType)));
     //_cmn.types.AddElement(tctn);
     if (_ctn != null) type_stack.Push(_ctn);
     _ctn = tctn;
     SystemLibrary.SystemLibrary.init_reference_type(tctn);
     return tctn;
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:15,代码来源:block_info.cs

示例3: visit_generic_params

 private void visit_generic_params(common_function_node cfn, List<SyntaxTree.ident> idents)
 {
     /*if (SemanticRules.RuntimeInitVariablesOfGenericParameters)
     {
         SystemLibrary.SystemLibInitializer.RuntimeInitializeFunction.Restore();
     }*/
     //ctn.is_generic_type_definition = true;
     check_param_redeclared(idents);
     cfn.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_function_container = cfn;
         cfn.generic_params.Add(par);
         cfn.scope.AddSymbol(id.name, new SymbolInfo(par));
         /*if (SemanticRules.RuntimeInitVariablesOfGenericParameters && !ctn.IsInterface)
         {
             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;
         }*/
     }
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:32,代码来源:syntax_tree_visitor.cs

示例4: ReadGenericParams

 private List<SemanticTree.ICommonTypeNode> ReadGenericParams(common_namespace_node cur_nn)
 {
     if (SemanticRules.RuntimeInitVariablesOfGenericParameters)
     {
         if (!SystemLibrary.SystemLibInitializer.NeedsToRestore.Contains(
             SystemLibrary.SystemLibInitializer.RuntimeInitializeFunction))
         {
             SystemLibrary.SystemLibInitializer.NeedsToRestore.Add(
                 SystemLibrary.SystemLibInitializer.RuntimeInitializeFunction);
         }
     }
     //common_namespace_node cur_nn = (is_interface) ? cun.namespaces[0] : cun.namespaces[1];
     int param_count = br.ReadInt32();
     List<SemanticTree.ICommonTypeNode> type_params = new List<PascalABCCompiler.SemanticTree.ICommonTypeNode>(param_count);
     for (int i = 0; i < param_count; i++)
     {
         string par_name = br.ReadString();
         common_type_node par = new common_type_node(
             par_name, SemanticTree.type_access_level.tal_public, cur_nn,
             SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.symbol_table.CreateInterfaceScope(null, SystemLibrary.SystemLibrary.object_type.Scope, null),
             null);
         SystemLibrary.SystemLibrary.init_reference_type(par);
         par.SetBaseType(SystemLibrary.SystemLibrary.object_type);
         type_params.Add(par);
     }
     return type_params;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:27,代码来源:PCUReader.cs

示例5: ReadTypeParameterEliminations

 private void ReadTypeParameterEliminations(common_type_node par)
 {
     switch ((GenericParamKind)(br.ReadByte()))
     {
         case GenericParamKind.Class:
             par.is_class = true;
             break;
         case GenericParamKind.Value:
             par.internal_is_value = true;
             break;
     }
     par.SetBaseType(GetTypeReference());
     par.SetImplementingInterfaces(ReadImplementingInterfaces());
     if (CanReadObject())
     {
         generic_parameter_eliminations.add_default_ctor(par);
     }
     //if (CanReadObject())
     //{
     //    par.runtime_initialization_marker = GetClassFieldByOffset();
     //}
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:22,代码来源:PCUReader.cs

示例6: create_enum_type

 public common_type_node create_enum_type(string name, location def_loc)
 {
     SymbolTable.ClassScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassScope(_cmn.scope, null);
     if (name == null)
         name = "$enum$" + rec_num++;
     common_type_node tctn = new common_type_node(name, SemanticTree.type_access_level.tal_public, _cmn,
         scope, def_loc);
     if (top_function != null)
         tctn.defined_in_scope = top_function.scope;
     set_field_access_level(SemanticTree.field_access_level.fal_public);
     //_cmn.scope.AddSymbol(name, new SymbolInfo(tctn));
     tctn.SetBaseType(compiled_type_node.get_type_node(NetHelper.NetHelper.EnumType));
     tctn.internal_is_value = true;
     
     add_convertions_to_enum_type(tctn);
     if (_ctn != null) type_stack.Push(_ctn);
     add_type(name, tctn, def_loc);
     _ctn = tctn;
     SystemLibrary.SystemLibrary.init_reference_type(tctn);
     return tctn;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:21,代码来源:compilation_context.cs

示例7: make_method

 //(ssyy) Создаёт метод псевдо-инстанции generic-типа.
 protected common_method_node make_method(function_node orig_fn, location loc)
 {
     if (orig_fn == null)
     {
         return null;
     }
     List<type_node> meth_inst_pars = null;
     SemanticTree.IClassMemberNode orig_member = orig_fn as SemanticTree.IClassMemberNode;
     common_method_node cmn = new common_method_node(
         orig_fn.name,
         //generic_convertions.determine_type(orig_fn.return_value_type, _instance_params, false),
         null,
         loc, this, orig_member.polymorphic_state, orig_member.field_access_level,
         null);
     if (orig_fn.is_generic_function)
     {
         List<type_node> orig_tpars = orig_fn.get_generic_params_list();
         int type_count = orig_tpars.Count;
         cmn.generic_params = new List<PascalABCCompiler.SemanticTree.ICommonTypeNode>(orig_tpars.Count);
         foreach (type_node t in orig_tpars)
         {
             common_type_node par = new common_type_node(t.name, PascalABCCompiler.SemanticTree.type_access_level.tal_public,
                 null, SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.symbol_table.CreateInterfaceScope(null, SystemLibrary.SystemLibrary.object_type.Scope, null), null);
             SystemLibrary.SystemLibrary.init_reference_type(par);
             par.SetBaseType(SystemLibrary.SystemLibrary.object_type);
             cmn.generic_params.Add(par);
             par.generic_function_container = cmn;
         }
         meth_inst_pars = cmn.get_generic_params_list();
         List<generic_parameter_eliminations> gpes = orig_fn.parameters_eliminations;
         for (int i = 0; i < type_count; ++i)
         {
             common_type_node p = (common_type_node)(meth_inst_pars[i]);
             generic_parameter_eliminations gpe = gpes[i];
             p.SetBaseType(generic_convertions.determine_type(
                 generic_convertions.determine_type(gpe.base_class, _instance_params, false),
                 meth_inst_pars, true));
             p.is_class = gpe.is_class;
             p.internal_is_value = gpe.is_value;
             foreach (type_node interf in gpe.implementing_interfaces)
             {
                 type_table.AddInterface(p, generic_convertions.determine_type(
                     generic_convertions.determine_type(interf, _instance_params, false),
                     meth_inst_pars, true), null);
             }
             if (gpe.has_default_ctor)
             {
                 generic_parameter_eliminations.add_default_ctor(p);
             }
         }
     }
     cmn.parameters.AddRange(make_parameters(orig_fn.parameters, cmn));
     if (orig_fn.is_generic_function)
     {
         foreach (common_parameter cp in cmn.parameters)
         {
             cp.type = generic_convertions.determine_type(cp.type, meth_inst_pars, true);
         }
     }
     common_method_node common_orig = orig_fn as common_method_node;
     if (common_orig != null)
     {
         cmn.num_of_default_variables = common_orig.num_of_default_variables;
     }
     compiled_constructor_node compiled_orig = orig_fn as compiled_constructor_node;
     cmn.is_constructor = (compiled_orig != null ||
         (common_orig != null && common_orig.is_constructor));
     cmn.return_value_type = generic_convertions.determine_type(orig_fn.return_value_type, _instance_params, false);
     if (orig_fn.is_generic_function)
     {
         cmn.return_value_type = generic_convertions.determine_type(cmn.return_value_type, meth_inst_pars, true);
     }
     return cmn;
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:75,代码来源:generics.cs

示例8: create_record_type

        public common_type_node create_record_type(location def_loc, string name)
        {
            SymbolTable.ClassScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassScope(_cmn.scope, null);
            if (name == null)
                name = "$record$" + rec_num++;
            common_type_node tctn = new common_type_node(name, SemanticTree.type_access_level.tal_public, _cmn,
                scope, def_loc);
            if (top_function != null)
                tctn.defined_in_scope = top_function.scope;
            set_field_access_level(SemanticTree.field_access_level.fal_public);
            tctn.SetBaseType(SemanticRules.StructBaseType);
            if (_ctn != null) type_stack.Push(_ctn);
            add_type(name, tctn, def_loc);
            _ctn = tctn;
            tctn.type_special_kind = SemanticTree.type_special_kind.record;
            SystemLibrary.SystemLibrary.init_reference_type(tctn);
            tctn.internal_is_value = true;
            return tctn;

        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:20,代码来源:compilation_context.cs

示例9: create_set_type

 public common_type_node create_set_type(type_node elem_type, location def_loc)
 {
     //if (elem_type == PascalABCCompiler.SystemLibrary.SystemLibrary.byte_type) 
     //	elem_type = PascalABCCompiler.SystemLibrary.SystemLibrary.integer_type;
 	if (TypedSets.ContainsKey(elem_type))
         return TypedSets[elem_type];
     string name = compiler_string_consts.GetSetTypeName(elem_type.name);
     /*common_type_node sctn = SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as common_type_node;
     sctn.type_special_kind = SemanticTree.type_special_kind.set_type;
     if (sctn.scope.Find(compiler_string_consts.assign_name) == null)
     sctn.scope.AddSymbol(compiler_string_consts.assign_name, sctn.scope.Find(compiler_string_consts.AssignSetName));
     return sctn;*/
     type_node base_type = SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as type_node;
     //check_name_free(name, def_loc);
     SymbolTable.ClassScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassScope(_cmn.scope, null);
     common_type_node tctn = new common_type_node(name, SemanticTree.type_access_level.tal_public, _cmn,
         scope, def_loc);
     set_field_access_level(SemanticTree.field_access_level.fal_public);
     _cmn.scope.AddSymbol(name, new SymbolInfo(tctn));
     tctn.type_special_kind = SemanticTree.type_special_kind.set_type;
     //tctn.add_intersection_node(type_intersection_node);
     tctn.element_type = elem_type;
     tctn.internal_is_value = base_type.is_value;
     tctn.is_class = base_type.is_class;
     tctn.SetBaseType(base_type);
     tctn.add_name(compiler_string_consts.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(tctn,PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
     //tctn.add_name(compiler_string_consts.assign_name,SystemLibrary.SystemLibInitializer.AssignSetProcedure.SymbolInfo);
     /*foreach (type_node tn in TypedSets.Keys)
     {
     	type_compare tc = type_table.compare_types(elem_type,tn);
     	if (tc != type_compare.non_comparable_type)
     	{
     		tctn.add_name(compiler_string_consts.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(TypedSets[tn],PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
     		TypedSets[tn].add_name(compiler_string_consts.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(tctn,PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
     	}
     }*/
     tctn.ImplementingInterfaces.Add(compiled_type_node.get_type_node(NetHelper.NetHelper.FindType(compiler_string_consts.IEnumerableInterfaceName)));
     //tctn.scope.AddSymbol(compiler_string_consts.and_name,SystemLibrary.)
     //_ctn = tctn;
     //if (tctn.scope.Find(compiler_string_consts.assign_name) != tctn.scope.Find(compiler_string_consts.AssignSetName))
       //  tctn.scope.AddSymbol(compiler_string_consts.assign_name, tctn.scope.Find(compiler_string_consts.AssignSetName));
     tctn.scope.AddSymbol(compiler_string_consts.plus_name, SystemLibrary.SystemLibInitializer.SetUnionProcedure.SymbolInfo);
     tctn.scope.AddSymbol(compiler_string_consts.mul_name, SystemLibrary.SystemLibInitializer.SetIntersectProcedure.SymbolInfo);
     tctn.scope.AddSymbol(compiler_string_consts.in_name, SystemLibrary.SystemLibInitializer.InSetProcedure.SymbolInfo);
     tctn.scope.AddSymbol(compiler_string_consts.minus_name, SystemLibrary.SystemLibInitializer.SetSubtractProcedure.SymbolInfo);
     tctn.scope.AddSymbol(compiler_string_consts.eq_name, SystemLibrary.SystemLibInitializer.CompareSetEquals.SymbolInfo);
     tctn.scope.AddSymbol(compiler_string_consts.noteq_name, SystemLibrary.SystemLibInitializer.CompareSetInEquals.SymbolInfo);
     tctn.scope.AddSymbol(compiler_string_consts.sm_name, SystemLibrary.SystemLibInitializer.CompareSetLess.SymbolInfo);
     tctn.scope.AddSymbol(compiler_string_consts.smeq_name, SystemLibrary.SystemLibInitializer.CompareSetLessEqual.SymbolInfo);
     tctn.scope.AddSymbol(compiler_string_consts.gr_name, SystemLibrary.SystemLibInitializer.CompareSetGreater.SymbolInfo);
     tctn.scope.AddSymbol(compiler_string_consts.greq_name, SystemLibrary.SystemLibInitializer.CompareSetGreaterEqual.SymbolInfo);
     tctn.scope.AddSymbol(compiler_string_consts.plusassign_name,new SymbolInfo(make_set_plus_assign(tctn)));
     tctn.scope.AddSymbol(compiler_string_consts.minusassign_name,new SymbolInfo(make_set_minus_assign(tctn)));
     tctn.scope.AddSymbol(compiler_string_consts.multassign_name,new SymbolInfo(make_set_mult_assign(tctn)));
     //SystemLibrary.SystemLibrary.init_reference_type(tctn);
     converted_namespace.types.AddElement(tctn);
     TypedSets.Add(elem_type, tctn);
     return tctn;            
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:59,代码来源:compilation_context.cs

示例10: create_typed_file_type

 public common_type_node create_typed_file_type(type_node elem_type, location def_loc)
 {
     if (TypedFiles.ContainsKey(elem_type))
         return TypedFiles[elem_type];
     string name = compiler_string_consts.GetTypedFileTypeName(elem_type.name);
     type_node base_type = SystemLibrary.SystemLibInitializer.TypedFileType.sym_info as type_node;
     //check_name_free(name, def_loc);
     SymbolTable.ClassScope scope = convertion_data_and_alghoritms.symbol_table.CreateClassScope(_cmn.scope, null);
     common_type_node tctn = new common_type_node(name, SemanticTree.type_access_level.tal_public, _cmn,
         scope, def_loc);
     set_field_access_level(SemanticTree.field_access_level.fal_public);
     _cmn.scope.AddSymbol(name, new SymbolInfo(tctn));
     tctn.type_special_kind = SemanticTree.type_special_kind.typed_file;
     tctn.element_type = elem_type;
     tctn.internal_is_value = base_type.is_value;
     tctn.is_class = base_type.is_class;
     tctn.SetBaseType(base_type);
     //_ctn = tctn;
     SystemLibrary.SystemLibrary.init_reference_type(tctn);
     converted_namespace.types.AddElement(tctn);
     TypedFiles.Add(elem_type, tctn);
     return tctn;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:23,代码来源:compilation_context.cs

示例11: visit_generic_params

 private void visit_generic_params(common_function_node cfn, List<SyntaxTree.ident> idents)
 {
     check_param_redeclared(idents);
     cfn.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_function_container = cfn;
         cfn.generic_params.Add(par);
         cfn.scope.AddSymbol(id.name, new SymbolInfo(par));
     }
 }
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:17,代码来源:syntax_tree_visitor.cs

示例12: create_array_type

		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)
			{
//.........这里部分代码省略.........
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:101,代码来源:type_constructor.cs


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