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


C# common_type_node.add_name方法代码示例

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


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

示例1: add_default_ctor

 public static void add_default_ctor(common_type_node 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));
     param.has_default_constructor = true;
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:11,代码来源:generics.cs

示例2: AddTypeToSetTypeList

 public static common_type_node AddTypeToSetTypeList(common_type_node tctn)
 {
 	if (instance.TypedSets.ContainsKey(tctn.element_type)) return instance.TypedSets[tctn.element_type];
 	instance.TypedSets.Add(tctn.element_type,tctn);
 	tctn.add_name(compiler_string_consts.assign_name,new SymbolInfo(SystemLibrary.SystemLibrary.make_assign_operator(tctn,PascalABCCompiler.SemanticTree.basic_function_type.objassign)));
 	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)));
     return tctn;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:20,代码来源:compilation_context.cs

示例3: 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

示例4: AddTypeCheckToStaticConstructor

 private void AddTypeCheckToStaticConstructor(common_type_node generic_def)
 {
     statements_list stl = new statements_list(null);
     GenericParameterAbilities gpa;
     foreach (common_type_node param in generic_def.generic_params)
     {
         if (syntax_tree_visitor.generic_param_abilities.TryGetValue(param, out gpa))
         {
             if (gpa.useful_for_pointers)
             {
                 stl.statements.AddElement(CreateTypeCheckCall(SystemLibrary.SystemLibInitializer.CheckCanUsePointerOnTypeProcedure.sym_info, param));
             }
             if (gpa.useful_for_binary_files)
             {
                 stl.statements.AddElement(CreateTypeCheckCall(SystemLibrary.SystemLibInitializer.CheckCanUseTypeForBinaryFilesProcedure.sym_info, param));
             }
             if (gpa.useful_for_typed_files)
             {
                 stl.statements.AddElement(CreateTypeCheckCall(SystemLibrary.SystemLibInitializer.CheckCanUseTypeForTypedFilesProcedure.sym_info, param));
             }
         }
         if (SemanticRules.RuntimeInitVariablesOfGenericParameters)
         {
             basic_function_call bfc = new basic_function_call(
                 SystemLibrary.SystemLibrary.byte_assign as basic_function_node, null);
             bfc.parameters.AddElement(new static_class_field_reference(param.runtime_initialization_marker, null));
             base_function_call dcall = null;
             if (SystemLibrary.SystemLibInitializer.RuntimeDetermineTypeFunction.sym_info is common_namespace_function_node)
                 dcall = new common_namespace_function_call(
                     SystemLibrary.SystemLibInitializer.RuntimeDetermineTypeFunction.sym_info as common_namespace_function_node, null);
             else
                 dcall = new compiled_static_method_call(
                     SystemLibrary.SystemLibInitializer.RuntimeDetermineTypeFunction.sym_info as compiled_function_node, null);
             dcall.parameters.AddElement(new typeof_operator(param, null));
             bfc.parameters.AddElement(dcall);
             stl.statements.AddElement(bfc);
         }
     }
     if (stl.statements.Count == 0) return;
     string stat_ctor_name = compiler_string_consts.static_ctor_prefix + compiler_string_consts.default_constructor_name;
     SymbolInfo si = generic_def.scope.FindOnlyInScope(stat_ctor_name);
     common_method_node stat_ctor;
     if (si == null)
     {
         stat_ctor = new common_method_node(stat_ctor_name, null, null, generic_def,
             SemanticTree.polymorphic_state.ps_static, SemanticTree.field_access_level.fal_public, null);
         stat_ctor.is_constructor = true;
         generic_def.add_name(stat_ctor_name, new SymbolInfo(stat_ctor));
         generic_def.methods.AddElement(stat_ctor);
     }
     else
     {
         stat_ctor = si.sym_info as common_method_node;
     }
     if (stat_ctor.function_code != null)
     {
         stl.statements.AddElement(stat_ctor.function_code);
     }
     else
     {
         stl.statements.AddElement(new return_node(null, null));
     }
     stat_ctor.function_code = stl;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:64,代码来源:compilation_context.cs

示例5: init_delegate

		public void init_delegate(common_type_node ctn, type_node return_value_type, parameter_list parameters,
		                                        location loc)
		{
			common_method_node constructor=new common_method_node(compiler_string_consts.default_constructor_name,null,loc,ctn,SemanticTree.polymorphic_state.ps_common,
			                                                      SemanticTree.field_access_level.fal_public,
			                                                      convertion_data_and_alghoritms.symbol_table.CreateScope(ctn.scope));
			constructor.is_constructor = true;
			constructor.return_value_type = ctn;
			constructor.function_code=new runtime_statement(SemanticTree.runtime_statement_type.ctor_delegate,loc);

			common_method_node invoke=new common_method_node(compiler_string_consts.invoke_method_name,
			                                                 return_value_type,loc,ctn,SemanticTree.polymorphic_state.ps_virtual,
			                                                 SemanticTree.field_access_level.fal_public,
			                                                 convertion_data_and_alghoritms.symbol_table.CreateScope(ctn.scope));
			ctn.add_name(compiler_string_consts.invoke_method_name,new SymbolInfo(invoke));
			for (int i=0; i<parameters.Count; i++)
			{
				if (parameters[i] is compiled_parameter)
				{
					parameters[i] = new common_parameter(parameters[i].name,parameters[i].type,parameters[i].parameter_type,invoke,concrete_parameter_type.cpt_none,null,null);
				}
			}
				
			invoke.parameters.AddRange(parameters);
			invoke.function_code = new runtime_statement(SemanticTree.runtime_statement_type.invoke_delegate, loc);

			common_method_node begin_invoke = new common_method_node(compiler_string_consts.begin_invoke_method_name,
			                                                         begin_invoke_result_type, loc, ctn, SemanticTree.polymorphic_state.ps_virtual, SemanticTree.field_access_level.fal_public,
			                                                         convertion_data_and_alghoritms.symbol_table.CreateScope(ctn.scope));
			ctn.add_name(compiler_string_consts.begin_invoke_method_name,new SymbolInfo(begin_invoke));
			parameter_list begin_invoke_params=new parameter_list();
			begin_invoke_params.AddRange(parameters);
			common_parameter cp=new common_parameter(compiler_string_consts.callback_string,begin_invoke_parameter_type,
			                                         SemanticTree.parameter_type.value,begin_invoke,concrete_parameter_type.cpt_none,
			                                         null,loc);
			begin_invoke_params.AddElement(cp);
			cp = new common_parameter(compiler_string_consts.object_in_par_string, SystemLibrary.SystemLibrary.object_type,
			                          SemanticTree.parameter_type.value,begin_invoke, concrete_parameter_type.cpt_none,
			                          null, loc);
			begin_invoke_params.AddElement(cp);
			begin_invoke.parameters.AddRange(begin_invoke_params);
			begin_invoke.function_code = new runtime_statement(SemanticTree.runtime_statement_type.begin_invoke_delegate, loc);

			common_method_node end_invoke = new common_method_node(compiler_string_consts.end_invoke_method_name,
			                                                       return_value_type, loc, ctn, SemanticTree.polymorphic_state.ps_virtual, SemanticTree.field_access_level.fal_public,
			                                                       convertion_data_and_alghoritms.symbol_table.CreateScope(ctn.scope));
			ctn.add_name(compiler_string_consts.end_invoke_method_name,new SymbolInfo(end_invoke));
			cp = new common_parameter(compiler_string_consts.result_string, begin_invoke_result_type,
			                          SemanticTree.parameter_type.value, end_invoke, concrete_parameter_type.cpt_none,
			                          null, loc);
			end_invoke.parameters.AddElement(cp);
			end_invoke.function_code = new runtime_statement(SemanticTree.runtime_statement_type.end_invoke_delegate, loc);

			ctn.methods.AddElement(constructor);
			ctn.methods.AddElement(invoke);
			ctn.methods.AddElement(begin_invoke);
			ctn.methods.AddElement(end_invoke);

			SystemLibrary.SystemLibrary.init_reference_type(ctn);

			delegate_internal_interface dii = new delegate_internal_interface(return_value_type, invoke, constructor);
			dii.parameters.AddRange(parameters);

			ctn.add_internal_interface(dii);
			AddOperatorsToDelegate(ctn, loc);
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:66,代码来源:type_constructor.cs


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