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


C# expressions_list.AddElement方法代码示例

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


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

示例1: make_pred_call

 private expression_node make_pred_call(SymbolInfo si, SyntaxTree.expression_list parameters, location loc)
 {
     if (parameters == null)
     {
         AddError(new NoFunctionWithSameParametresNum(loc, false, si.sym_info as function_node));
         return null;
     }
 	if (parameters.expressions.Count == 1)
 	{
 		expression_node param0 = convert_strong(parameters.expressions[0]);
 		if (param0 is typed_expression) param0 = convert_typed_expression_to_function_call(param0 as typed_expression);
 		basic_function_call bfc = null;
 		int type_flag = 0;
 		expressions_list el = new expressions_list();
 		el.AddElement(param0);
 		function_node fn = null;
 		try
 		{
 			fn = convertion_data_and_alghoritms.select_function(el,si,loc);
 		}
 		catch(Exception e)
 		{
 			
 		}
 		if (fn != null)
 		{
             if (fn is common_namespace_function_node)
             {
                 common_namespace_function_call cnfc = new common_namespace_function_call(fn as common_namespace_function_node, loc);
                 cnfc.parameters.AddElement(param0);
                 return cnfc;
             }
             else
             {
                 compiled_static_method_call cnfc = new compiled_static_method_call(fn as compiled_function_node, loc);
                 cnfc.parameters.AddElement(param0);
                 return cnfc;
             }
 		}
 		else if (param0.type.type_special_kind == PascalABCCompiler.SemanticTree.type_special_kind.diap_type || param0.type.IsEnum)
 		{
 			el = new expressions_list();
 			el.AddElement(new int_const_node(1,null));
 			fn = convertion_data_and_alghoritms.select_function(el,si,loc);
 			//bfc = new basic_function_call(SystemLibrary.SystemLibrary.int_add as basic_function_node,loc);
 			//bfc.ret_type = param0.type;
             if (fn is common_namespace_function_node)
             {
                 common_namespace_function_call cnfc = new common_namespace_function_call(fn as common_namespace_function_node, loc);
                 cnfc.parameters.AddElement(param0);
                 cnfc.type = param0.type;
                 return cnfc;
             }
             else
             {
                 compiled_static_method_call cnfc = new compiled_static_method_call(fn as compiled_function_node, loc);
                 cnfc.parameters.AddElement(param0);
                 cnfc.type = param0.type;
                 return cnfc;
             }
 		}
 		else AddError(new NoFunctionWithSameArguments(loc,false));
 		bfc.parameters.AddElement(param0);
 		if (type_flag == 0 || type_flag == 3)
 		bfc.parameters.AddElement(new int_const_node(1,null));
 		else if (type_flag == 1)
 		bfc.parameters.AddElement(new long_const_node(1,null));
 		else if (type_flag == 2)
 		bfc.parameters.AddElement(new ulong_const_node(1,null));
 		return bfc;
 	}
 	AddError(new NoFunctionWithSameParametresNum(loc,false,si.sym_info as function_node));
     return null;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:74,代码来源:syntax_tree_visitor.cs

示例2: visit

        public override void visit(SyntaxTree.pascal_set_constant _pascal_set_constant)
        {
            //throw new NotSupportedError(get_location(_pascal_set_constant));
            if (SystemLibrary.SystemLibInitializer.TypedSetType == null || SystemLibrary.SystemLibInitializer.CreateSetProcedure == null)
            	AddError(new NotSupportedError(get_location(_pascal_set_constant)));
            expressions_list consts = new expressions_list();
            type_node el_type = null;
            type_node_list types = new type_node_list();
            if (_pascal_set_constant.values != null && _pascal_set_constant.values != null)
                foreach (SyntaxTree.expression e in _pascal_set_constant.values.expressions)
                {
            		if (e is SyntaxTree.nil_const)
                        ErrorsList.Add(new SimpleSemanticError(get_location(e), "NIL_IN_SET_CONSTRUCTOR_NOT_ALLOWED"));
            		else
            		if (e is SyntaxTree.diapason_expr)
                    {
                        consts.AddElement(convert_diap_for_set((e as SyntaxTree.diapason_expr), out el_type));
                        if (el_type.IsPointer)
                            ErrorsList.Add(new SimpleSemanticError(get_location(e), "POINTERS_IN_SETS_NOT_ALLOWED"));
                        types.AddElement(el_type);
                    }
                    else
                    {
                        expression_node en = convert_strong(e);
                        if (en is typed_expression) en = convert_typed_expression_to_function_call(en as typed_expression);
                        if (en.type.type_special_kind == SemanticTree.type_special_kind.short_string)
                        	en.type = SystemLibrary.SystemLibrary.string_type;
                        consts.AddElement(en);
                        types.AddElement(en.type);
                    }
                }
            expressions_list consts_copy = new expressions_list();
            consts_copy.AddRange(consts);
            type_node ctn = null;
            if (consts.Count > 0)
            {
                el_type = convertion_data_and_alghoritms.select_base_type(types);
                ctn = context.create_set_type(el_type, get_location(_pascal_set_constant));

            }
            else ctn = SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as type_node;
            function_node fn = convertion_data_and_alghoritms.select_function(consts, SystemLibrary.SystemLibInitializer.CreateSetProcedure.SymbolInfo, (SystemLibrary.SystemLibInitializer.CreateSetProcedure.sym_info is common_namespace_function_node)?(SystemLibrary.SystemLibInitializer.CreateSetProcedure.sym_info as common_namespace_function_node).loc:null);
            if (fn is common_namespace_function_node)
            {
                common_namespace_function_call cnfc = new common_namespace_function_call(fn as common_namespace_function_node, get_location(_pascal_set_constant));
                add_set_initializer(cnfc, consts_copy);
                cnfc.ret_type = ctn;
                for (int i = 0; i < consts.Count; i++)
                    cnfc.parameters.AddElement(consts[i]);
                return_value(cnfc);
            }
            else
            {
                compiled_static_method_call cnfc = new compiled_static_method_call(fn as compiled_function_node, get_location(_pascal_set_constant));
                add_set_initializer(cnfc, consts_copy);
                cnfc.ret_type = ctn;
                for (int i = 0; i < consts.Count; i++)
                    cnfc.parameters.AddElement(consts[i]);
                return_value(cnfc);
            }
            //return_value(new common_namespace_function_call_as_constant(cnfc,cnfc.location));
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:62,代码来源:syntax_tree_visitor.cs

示例3: visit_method_call


//.........这里部分代码省略.........
                                        if (si.sym_info.general_node_type == general_node_type.type_node)
                                        {
                                            to_type = ((type_node)(si.sym_info));
                                        }
                                        else
                                        {
                                            dot_node_as_expression_dot_ident(exp, id_right, motivation.expression_evaluation, _dot_node.left);
                                            exp = ret.get_expression();
                                            internal_interface ii = exp.type.get_internal_interface(internal_interface_kind.delegate_interface);
                                            if (ii == null)
                                            {
                                                AddError(subloc, "EXPECTED_DELEGATE");
                                            }
                                            delegate_internal_interface dii = ii as delegate_internal_interface;
                                            si = new SymbolInfo(dii.invoke_method);
                                        }
                                    }

                                    if (to_type != null)
                                    {
                                        if ((_method_call.parameters == null) || (_method_call.parameters.expressions.Count != 1))
                                        {
                                            AddError(get_location(_method_call), "ONLY_ONE_PARAMETER_OF_TYPE_CONVERSION_ALLOWED" );
                                        }
                                    }
                                    SymbolInfo tmp_si = si;
                                    while (si != null)
                                    {
                                        if (si.sym_info is common_namespace_function_node)
                                        {
                                            common_namespace_function_node cnfn = si.sym_info as common_namespace_function_node;
                                            if (cnfn.ConnectedToType != null && !cnfn.IsOperator)
                                            {
                                                exprs.AddElementFirst(exp);
                                                skip_first_parameter = true;
                                                break;
                                            }
                                        }
                                        if (si.sym_info is compiled_function_node)
                                        {
                                            compiled_function_node cfn = si.sym_info as compiled_function_node;
                                            if (cfn.ConnectedToType != null)
                                            {
                                                exprs.AddElementFirst(exp);
                                                skip_first_parameter = true;
                                                if (cfn.is_generic_function)
                                                {
                                                    //generic_convertions.DeduceFunction(cfn, exprs);
                                                    //si.sym_info = cfn.get_instance(new List<type_node>(new type_node[] { exp.type }), true, get_location(_method_call));
                                                }
                                                break;
                                            }

                                        }
                                        si = si.Next;
                                    }
                                    
                                    si = tmp_si;
                                    if (skip_first_parameter)
                                    {
                                        SymbolInfo new_si = null;
                                        bool has_obj_methods = false;
                                        List<SymbolInfo> si_list = new List<SymbolInfo>();
                                        while (si != null)
                                        {
                                            if (si.sym_info is common_namespace_function_node)
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:67,代码来源:syntax_tree_visitor.cs

示例4: get_init_call_for_short_string

        internal expression_node get_init_call_for_short_string(var_definition_node vdn)
        {
            location loc = (vdn.type as short_string_type_node).loc;

            type_node tn = vdn.type;
            //vdn.type = SystemLibrary.SystemLibInitializer.ShortStringType.TypeNode;
			vdn.type = SystemLibrary.SystemLibrary.string_type;
            int Length = (tn as short_string_type_node).Length;

            expression_node var_ref = create_variable_reference(vdn, loc);
            expressions_list exl = new expressions_list();
            exl.AddElement(var_ref);
            exl.AddElement(new int_const_node(Length, loc));
            expression_node expr = null;
            //if (SystemLibrary.SystemLibInitializer.ShortStringTypeInitProcedure != null)
            //convertion_data_and_alghoritms.create_full_function_call(exl, SystemLibrary.SystemLibInitializer.ShortStringTypeInitProcedure.SymbolInfo, null, context.converted_type, context.top_function, true);

            vdn.type = tn;

            return expr;
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:21,代码来源:syntax_tree_visitor.cs

示例5: convert_expression_list

 private expressions_list convert_expression_list(List<SyntaxTree.expression> expr_list)
 {
     expressions_list exprs = new expressions_list();
     foreach (SyntaxTree.expression en in expr_list)
         exprs.AddElement(convert_strong(en));
     return exprs;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:7,代码来源:syntax_tree_visitor.cs

示例6: convert_function_call_expressions

		private void convert_function_call_expressions(function_node fn,expressions_list exprs,
			possible_type_convertions_list ptcal)
		{
			/*if (SystemLibrary.SystemLibrary.syn_visitor.SystemUnitAssigned && fn.name != compiler_string_consts.assign_name && !SystemLibrary.SystemLibrary.syn_visitor.one_way_operation(fn.name) && SystemLibrary.SystemLibrary.syn_visitor.in_check_range_region())
            {
				for (int i=0; i<exprs.Count; i++)
				{
					if (exprs[i] is statements_expression_node)
						break;
					expression_node right = exprs[i];
					if (fn.parameters.Count <= i)
						break;
					if (fn.parameters[i].parameter_type == parameter_type.var)
						continue;
					type_node left_type = fn.parameters[i].type;
					
					if (SystemLibrary.SystemLibrary.syn_visitor.is_range_checkable(left_type) && SystemLibrary.SystemLibrary.syn_visitor.is_range_checkable(exprs[i].type))
					{
						ordinal_type_interface oti = left_type.get_internal_interface(internal_interface_kind.ordinal_interface) as ordinal_type_interface;
            			if (left_type != SystemLibrary.SystemLibrary.char_type) 
            			if(!(oti.lower_value is enum_const_node) && !(oti.lower_value is char_const_node))
            			right = SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.convert_type(SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.create_simple_function_call(SystemLibrary.SystemLibInitializer.CheckRangeFunction.sym_info as common_namespace_function_node, null, SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.convert_type(right,SystemLibrary.SystemLibrary.int64_type), 
            				                                                                                                                                                                                               SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.convert_type(oti.lower_value,SystemLibrary.SystemLibrary.int64_type),SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.convert_type(oti.upper_value,SystemLibrary.SystemLibrary.int64_type)),right.type);
            			else if (oti.lower_value is enum_const_node)
            			{
            				right = SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.explicit_convert_type(SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.create_simple_function_call(SystemLibrary.SystemLibInitializer.CheckRangeFunction.sym_info as common_namespace_function_node, null, SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.explicit_convert_type(right,SystemLibrary.SystemLibrary.int64_type),
            		                                                                                                               SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.explicit_convert_type(oti.lower_value,SystemLibrary.SystemLibrary.int64_type),SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.explicit_convert_type(oti.upper_value,SystemLibrary.SystemLibrary.int64_type)),right.type);
            			}
            			else if (oti.lower_value is char_const_node)
            			right = SystemLibrary.SystemLibrary.syn_visitor.convertion_data_and_alghoritms.create_simple_function_call(SystemLibrary.SystemLibInitializer.CheckCharRangeFunction.sym_info as common_namespace_function_node, null, right, oti.lower_value,oti.upper_value);
					
					}
					exprs[i] = right;
				}
            }*/
			for(int i=0;i<exprs.Count;i++)
			{
                if ((ptcal.snl != null) && (i >= fn.parameters.Count - 1))
                {
                    //statement_list_stack.top().statements.AddRange(ptcal.snl);
                    statements_expression_node sre = new statements_expression_node(ptcal.snl, ptcal.var_ref, ptcal.var_ref.location);
                    exprs.remove_range(fn.parameters.Count - 1, exprs.Count - fn.parameters.Count);
                    //exprs.AddElement(ptcal.var_ref);
                    //exprs[i] = ptcal.var_ref;
                    exprs[i] = sre;
                    break;
                }
                if ((ptcal[i]==null)||(ptcal[i].first==null)||exprs[i] is null_const_node)
				{
					continue;
				}
                expression_node[] temp_arr = new expression_node[1];
                temp_arr[0] = exprs[i];
                if (ptcal[i].first.convertion_method is compiled_constructor_node)
                    exprs[i] = create_compiled_construcor_call(ptcal[i].first.convertion_method as compiled_constructor_node, get_location(exprs[i]), temp_arr);
                else
                    exprs[i] = create_simple_function_call(ptcal[i].first.convertion_method, get_location(exprs[i]), temp_arr);
			}
            //TODO: Можно сделать параметры по умолчанию для откомпилированных функций.
            if ((exprs.Count < fn.parameters.Count) && (fn.node_kind == SemanticTree.node_kind.common))
            {
                if (exprs.Count == 0 && fn.parameters != null && fn.parameters.Count == 1 && fn.parameters[0].is_params ||
                    exprs.Count == 1 && fn.parameters != null && fn is common_namespace_function_node && (fn as common_namespace_function_node).ConnectedToType != null &&
                    fn.parameters.Count == 2 && fn.parameters[1].is_params)
                {
                    statements_expression_node sre = new statements_expression_node(ptcal.snl, ptcal.var_ref, ptcal.var_ref.location);
                    //exprs.remove_range(fn.parameters.Count - 1, exprs.Count - fn.parameters.Count);
                    //exprs.AddElement(ptcal.var_ref);
                    //exprs[i] = ptcal.var_ref;
                    exprs.AddElement(sre);
                }
                common_function_node cfn = (common_function_node)fn;
                for (int j = exprs.Count; j < cfn.parameters.Count; j++)
                {
                    common_parameter cp = (common_parameter)cfn.parameters[j];
                    if (cp.default_value != null)
                        exprs.AddElement(cp.default_value);
                }
            }
            else if ((exprs.Count < fn.parameters.Count) && (fn.node_kind == SemanticTree.node_kind.compiled))
            {
                if (exprs.Count == 0 && fn.parameters != null && fn.parameters.Count == 1 && fn.parameters[0].is_params)
                {
                    statements_expression_node sre = new statements_expression_node(ptcal.snl, ptcal.var_ref, ptcal.var_ref.location);
                    exprs.AddElement(sre);
                }
                //compiled_function_node cfn = (compiled_function_node)fn;
                for (int j = exprs.Count; j < fn.parameters.Count; j++)
                {
                    compiled_parameter cp = (compiled_parameter)fn.parameters[j];
                    if (cp.default_value != null)
                        exprs.AddElement(cp.default_value);
                }
            }
			
		}
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:96,代码来源:convertion_data_and_alghoritms.cs

示例7: get_init_call_for_typed_file

        internal expression_node get_init_call_for_typed_file(var_definition_node vdn, type_node element_type)
        {
            location loc = (vdn.type as common_type_node).loc;
            if (!SystemUnitAssigned)
                AddError(new NotSupportedError(loc));
            //Когда заработает наследование конструкторов надо вставить это
            /*
            expression_node var_ref = create_variable_reference(vdn, loc);
            expressions_list exl = new expressions_list();
            exl.AddElement(new typeof_operator(element_type, loc));
            base_function_call bfc = create_constructor_call(vdn.type, exl, loc);
            expression_node expr = find_operator(compiler_string_consts.assign_name, var_ref, bfc, loc);
            */

            type_node tn = vdn.type;
            vdn.type = SystemLibrary.SystemLibInitializer.TypedFileType.sym_info as type_node;

            expression_node var_ref = create_variable_reference(vdn, loc);
            expressions_list exl = new expressions_list();
            exl.AddElement(var_ref);
            exl.AddElement(new typeof_operator(element_type, loc));
            List<int> lens = get_short_string_lens(element_type);
            int sz = get_short_string_size(element_type);
            if (sz > 0)
            {
            	exl.AddElement(new int_const_node(get_short_string_size(element_type),null));
            	for (int i=0; i<lens.Count; i++)
            		exl.AddElement(new int_const_node(lens[i],null));
            }
            this.context.save_var_definitions();
            function_node fn = convertion_data_and_alghoritms.select_function(exl, SystemLibrary.SystemLibInitializer.TypedFileInitProcedure.SymbolInfo, loc);
            this.context.restore_var_definitions();
            expression_node expr = convertion_data_and_alghoritms.create_simple_function_call(fn, null, exl.ToArray());

            vdn.type = tn;

            return expr;
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:38,代码来源:syntax_tree_visitor.cs

示例8: inherited_message_value_reciving

 private expression_node inherited_message_value_reciving(SyntaxTree.inherited_message _ident)
 {
 	SymbolInfo si = find_in_base(_ident);
 	bool constr = false;
     if (si != null) 
     if (si.sym_info is common_method_node)
     {
     	if ((si.sym_info as common_method_node).polymorphic_state == SemanticTree.polymorphic_state.ps_virtual_abstract)
             AddError(get_location(_ident), "CANNOT_CALL_ABSTRACT_METHOD");
     	constr = (si.sym_info as common_method_node).is_constructor;
     }
     else
     if (si.sym_info is compiled_function_node)
     {
     	if ((si.sym_info as compiled_function_node).polymorphic_state == SemanticTree.polymorphic_state.ps_virtual_abstract)
             AddError(get_location(_ident), "CANNOT_CALL_ABSTRACT_METHOD");
     }
     else if (si.sym_info is compiled_constructor_node)
     {
     	constr = true;
     }
     location loc = get_location(_ident);
     function_node fn = si.sym_info as function_node;
     base_function_call bfc = null;
     common_function_node cfn = context.converted_func_stack.first();
     int depth = context.converted_func_stack.size-1;
     if (!constr)
     {
     	if (fn.polymorphic_state != SemanticTree.polymorphic_state.ps_static)
     	{
     		bfc = create_not_static_method_call(fn,new this_node(context.converted_type,loc),loc,true);
     		if (bfc is common_method_call)
     			(bfc as common_method_call).virtual_call = false;
     		else 
     			(bfc as compiled_function_call).virtual_call = false;
     	}
     	else if (fn is common_method_node)
     		bfc = create_static_method_call(fn,loc,(fn as common_method_node).cont_type,true);
     	else if (fn is compiled_function_node)
     		bfc = create_static_method_call(fn,loc,(fn as compiled_function_node).cont_type,true);
     	else
     		throw new NotSupportedError(loc);
     }
     else
     {
     	if (!context.allow_inherited_ctor_call)
             AddError(loc, "INHERITED_CONSTRUCTOR_CALL_MUST_BE_FIRST");
     	expressions_list exprs = new expressions_list();
     	foreach (common_parameter cp in cfn.parameters)
     	{
     		exprs.AddElement(new common_parameter_reference(cp,depth,loc));
     	}
     	if (fn is common_method_node)
     	{
     		common_constructor_call ccc = create_constructor_call((fn as common_method_node).cont_type,exprs,loc) as common_constructor_call;
     		ccc._new_obj_awaited = false;
     		return ccc;
     	}
     	else if (fn is compiled_constructor_node)
     	{
     		compiled_constructor_call ccc = create_constructor_call((fn as compiled_constructor_node).compiled_type,exprs,loc) as compiled_constructor_call;
     		ccc._new_obj_awaited = false;
     		return ccc;
     	}
     	else
     	throw new NotSupportedError(loc);
     }
     
     foreach (common_parameter cp in cfn.parameters)
     {
     	bfc.parameters.AddElement(new common_parameter_reference(cp,depth,loc));
     }
     return bfc;
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:74,代码来源:syntax_tree_visitor.cs

示例9: convert_functions_to_calls

        private base_function_call_list convert_functions_to_calls(expression_node obj, function_node_list fnl, location loc, bool is_static)
        {
            base_function_call_list ret = new base_function_call_list();
            foreach (function_node fnode in fnl)
            {
                base_function_call bfc = null;
                switch (fnode.semantic_node_type)
                {
                    case semantic_node_type.common_namespace_function_node:
                        {
                            common_namespace_function_node cmfn = fnode as common_namespace_function_node;
                            common_namespace_function_call cnfc = new common_namespace_function_call(cmfn, loc);
                            if (cmfn.ConnectedToType != null)
                                cnfc.parameters.AddElement(obj);
                            if (cmfn.is_generic_function && !cmfn.is_generic_function_instance && cmfn.ConnectedToType != null && cmfn.parameters.Count == 1)
                            {
                                expressions_list parameters = new expressions_list();
                                parameters.AddElement(obj);
                                function_node inst = null;
                                try
                                {
                                    inst = generic_convertions.DeduceFunction(cmfn, parameters, true, loc);
                                }
                                catch
                                {
                                    continue;
                                }
                                cnfc = new common_namespace_function_call((common_namespace_function_node)inst, loc);
                                if (cmfn.ConnectedToType != null)
                                    cnfc.parameters.AddElement(obj);
                            }
                            /*if (cmfn.parameters.Count >= 1 && cmfn.parameters[cmfn.parameters.Count - 1].is_params)
                            {
                                convertion_data_and_alghoritms.select_function(cnfc.parameters, new SymbolInfo(cmfn), loc);
                                
                            }*/
                            bfc = cnfc;
                            break;
                        }
                    case semantic_node_type.basic_function_node:
                        {
                            //Может здесь стоит и выругаться, но я не буду пока этого делать.
                            break;
                        }
                    case semantic_node_type.common_in_function_function_node:
                        {
                            common_in_function_function_node ciffn = fnode as common_in_function_function_node;
                            int depth = convertion_data_and_alghoritms.symbol_table.GetRelativeScopeDepth(ciffn.scope,
                                context.top_function.scope);
                            common_in_function_function_call ciffc = new common_in_function_function_call(ciffn, depth, loc);
                            bfc = ciffc;
                            break;
                        }
                    case semantic_node_type.common_method_node:
                        {
                            common_method_node cmn = fnode as common_method_node;
                            //Если cmn конструктор - то плохо, но его не должно сюда попасть.
                            if (cmn.polymorphic_state != SemanticTree.polymorphic_state.ps_static)
                            {
                                if (!is_static)
                                {
                                    if (obj == null)
                                        obj = GetCurrentObjectReference(cmn.cont_type.Scope, cmn, loc);//new this_node(context.converted_type, loc);
                                    common_method_call cmc = new common_method_call(cmn, obj, loc);
                                    cmc.virtual_call = !inherited_ident_processing;
                                    bfc = cmc;
                                }
                                //ssyy!!! Мне сложно понять предназначение данного кода, но, по-видимому,
                                //следует его переписать так.
                                else if (cmn.is_constructor)
                                {
                                    if (cmn.parameters.Count == 0)
                                    {
                                    	if (cmn.cont_type.IsAbstract)
                                            AddError(loc, "ABSTRACT_CONSTRUCTOR_{0}_CALL", cmn.cont_type.name);
                                    	ret.clear();
                                        ret.AddElement(new common_constructor_call(cmn, loc));
                                        return ret;
                                    }
                                }
                            }
                            else
                            {
                                if (is_static)
                                {
                                    common_static_method_call csmc = new common_static_method_call(cmn, loc);
                                    bfc = csmc;
                                }
                            }
                            break;
                        }
                    case semantic_node_type.compiled_function_node:
                        {
                            compiled_function_node cfn = fnode as compiled_function_node;
                            if (cfn.cont_type.Scope == null && cfn is compiled_function_node)
                        	(cfn.cont_type as compiled_type_node).init_scope();
                            
                            if (cfn.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
                            {
                                //ispravleno ibond
//.........这里部分代码省略.........
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:101,代码来源:syntax_tree_visitor.cs

示例10: make_attributes_for_declaration

        private void make_attributes_for_declaration(SyntaxTree.unit_module un, common_unit_node cun)
        {
            if (cun.attributes != null)
            {
                Hashtable ht = new Hashtable();
                foreach (SyntaxTree.simple_attribute_list sal in un.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(cun, 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));
                        attribute_node attr_node = new attribute_node(bfc.simple_function_node, tn, get_location(un));
                        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(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;
//.........这里部分代码省略.........
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:101,代码来源:syntax_tree_visitor.cs

示例11: find_operator

        public expression_node find_operator(string name, expression_node left, expression_node right, location loc)
        {
            //if (!CheckExpressionType(left))
            //    return SystemLibrary.SystemLibrary.get_empty_method_call(left.location);
            //if (!CheckExpressionType(right))
            //    return SystemLibrary.SystemLibrary.get_empty_method_call(right.location);
            //string name=name_reflector.get_name(ot);
#if (DEBUG)
            if (name == null)
            {
                throw new CompilerInternalError("Invalid operator name");
            }
#endif

            if (right.semantic_node_type == semantic_node_type.null_const_node)
            {
            	if ( !type_table.is_with_nil_allowed(left.type) && !left.type.IsPointer)
                    AddError(right.location, "NIL_WITH_VALUE_TYPES_NOT_ALLOWED");
            	right = null_const_node.get_const_node_with_type(left.type, (null_const_node)right);
            }

            type_node left_type = left.type;
            type_node right_type = right.type;
			
            /*if (left.type == SystemLibrary.SystemLibrary.uint64_type || right.type == SystemLibrary.SystemLibrary.uint64_type)
            	if (name == compiler_string_consts.plus_name || name == compiler_string_consts.minus_name || name == compiler_string_consts.mul_name || name == compiler_string_consts.idiv_name || name == compiler_string_consts.mod_name)
            	{
                    expression_node expr = right.type != SystemLibrary.SystemLibrary.uint64_type ? right : left;
                    if (!(expr is constant_node))
                    {
                        type_node tn = expr.type;
                        if (tn == SystemLibrary.SystemLibrary.short_type || tn == SystemLibrary.SystemLibrary.sbyte_type || tn == SystemLibrary.SystemLibrary.integer_type || tn == SystemLibrary.SystemLibrary.int64_type)
                            throw new OperatorCanNotBeAppliedToThisTypes(name, left, right, loc);
                    }
            	}
            */

            if (left_type.semantic_node_type == semantic_node_type.delegated_method)
            {
                delegated_methods dm1 = (delegated_methods)left_type;
                if (dm1.empty_param_method != null)
                {
                    if (dm1.empty_param_method.simple_function_node.return_value_type != null)
                    {
                        left_type = dm1.empty_param_method.simple_function_node.return_value_type;
                    }
                }
            }

            if (right_type.semantic_node_type == semantic_node_type.delegated_method && name != compiler_string_consts.plusassign_name && name != compiler_string_consts.minusassign_name)
            {
                delegated_methods dm2 = (delegated_methods)right_type;
                if (dm2.empty_param_method != null)
                {
                    if (dm2.empty_param_method.simple_function_node.return_value_type != null)
                    {
                        right_type = dm2.empty_param_method.simple_function_node.return_value_type;
                    }
                }
            }
			
            //zdes ne vse verno. += odnostoronnjaa operacija, a += b pochemu esli tipy ne ravny, += ishetsja v tipe b???
            //TODO: Посмотреть.
            //TODO: Не find а find_in_type.
            //SymbolInfo si=left_type.find(name, context.CurrentScope);
            SymbolInfo si = left_type.find_in_type(name, left_type.Scope);
            SymbolInfo added_symbols = null;
            SymbolInfo si2 = null;
            if (left_type != right_type && !one_way_operation(name))
            {
                //SymbolInfo si2 = right_type.find(name, context.CurrentScope);
                if (si != null)
                    si = si.copy();
                si2 = right_type.find_in_type(name, right_type.Scope);
                if ((si != null) && (si2 != null))
                {
                    //Важная проверка. Возможно один и тот же оператор с одними и теми же типами определен в двух разных классах.
                    //Возможно она занимает много времени, но, наверное, от нее нельзя отказаться.
                    function_node_list funcs = new function_node_list();
                    SymbolInfo sic = si;
                    SymbolInfo sic_last = null;
                    while (sic != null)
                    {
                        if (sic.sym_info.general_node_type != general_node_type.function_node)
                        {
                            BasePCUReader.RestoreSymbols(sic, name);
                        }
#if (DEBUG)
                        if (sic.sym_info.general_node_type != general_node_type.function_node)
                        {
                            throw new CompilerInternalError("Expected operator.");
                        }
#endif
                        
                        function_node fn = ((function_node)(sic.sym_info));
                        if (convertion_data_and_alghoritms.is_exist_eq_method_in_list(fn, funcs) != null)
                        {
                            break;
                        }
                        funcs.AddElement(fn);
//.........这里部分代码省略.........
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:101,代码来源:syntax_tree_visitor.cs

示例12: make_dec_call

        private expression_node make_dec_call(SymbolInfo si, SyntaxTree.expression_list parameters, location loc)
        {
        	if (parameters == null) throw new NoFunctionWithSameParametresNum(loc,false,si.sym_info as function_node);
        	if (parameters.expressions.Count == 1 || parameters.expressions.Count == 2)
        	{
        		expression_node param0 = convert_strong(parameters.expressions[0]);
        		if (!param0.is_addressed)
        		{
        			bool is_pascal_array_ref = false;
                    if (param0.semantic_node_type == semantic_node_type.common_method_call)
                    {
                        common_method_call cmc = (common_method_call)param0;
                        internal_interface ii = cmc.obj.type.get_internal_interface(internal_interface_kind.bounded_array_interface);
                        if (ii != null)
                        {
                            if (cmc.function_node.name == compiler_string_consts.get_val_pascal_array_name)
                            {
                                bounded_array_interface bai = (bounded_array_interface)ii;
                                class_field cf = bai.int_array;
                                expression_node left = new class_field_reference(cf, cmc.obj, cmc.location);
                                expression_node right = cmc.parameters[0];
                                //right = convert_type(right, SystemLibrary.SystemLibrary.integer_type);
                                right = convertion_data_and_alghoritms.convert_type(right, (ii as bounded_array_interface).ordinal_type_interface.elems_type);
                                right = convertion_data_and_alghoritms.create_simple_function_call(SystemLibrary.SystemLibrary.int_sub, cmc.location, right,
                                    new int_const_node(bai.ordinal_type_interface.ordinal_type_to_int(bai.ordinal_type_interface.lower_value), cmc.location));
                                param0 = new simple_array_indexing(left, right, cmc.type, cmc.location);
                                is_pascal_array_ref = true;

                            }
                        }
                        if (!is_pascal_array_ref)
                        {
							throw new ThisExpressionCanNotBePassedAsVarParameter(param0);
                    	}
        				
        			}
                    else if (param0 is compiled_function_call)
                    {
                    	compiled_function_call cfc = param0 as compiled_function_call;
                    	if ((cfc.function_node.return_value_type == SystemLibrary.SystemLibrary.char_type && cfc.function_node.cont_type == SystemLibrary.SystemLibrary.string_type
                    	      && cfc.function_node == cfc.function_node.cont_type.default_property_node.get_function))
                    	{
                    		expressions_list exl = new expressions_list();
                            exl.AddElement(cfc.obj);
                            exl.AddElement(cfc.parameters[0]);
                            basic_function_call bfc2 = new basic_function_call(SystemLibrary.SystemLibrary.int_sub as basic_function_node,loc);
                            bfc2.parameters.AddElement(param0);
                            expression_node _param1 = null;
                            if (parameters.expressions.Count == 2) 
        					{
        						_param1 = convert_strong(parameters.expressions[1]);
        					}
                            if (_param1 != null)
                            	bfc2.parameters.AddElement(convertion_data_and_alghoritms.convert_type(_param1,SystemLibrary.SystemLibrary.integer_type));
                            else
                            	bfc2.parameters.AddElement(new int_const_node(1,null));
                            expressions_list el = new expressions_list();
                            el.AddElement(convertion_data_and_alghoritms.convert_type(bfc2,SystemLibrary.SystemLibrary.ushort_type));
                            function_node chr_func = convertion_data_and_alghoritms.select_function(el, SystemLibrary.SystemLibInitializer.ChrUnicodeFunction.SymbolInfo, loc);
                            exl.AddElement(convertion_data_and_alghoritms.create_simple_function_call(chr_func, loc, el.ToArray()));
                            function_node fn = convertion_data_and_alghoritms.select_function(exl, SystemLibrary.SystemLibInitializer.StringDefaultPropertySetProcedure.SymbolInfo, loc);
                            expression_node ret = convertion_data_and_alghoritms.create_simple_function_call(fn, loc, exl.ToArray());
                            return ret;
                    	}
                    	else
                    	{
                    		throw new ThisExpressionCanNotBePassedAsVarParameter(param0);
                    	}
                    }
                    else throw new ThisExpressionCanNotBePassedAsVarParameter(param0);
        		}
        		else
        			check_on_loop_variable(param0);
        		expression_node param1 = null;
        		int type_flag = 0;
        		bool is_uint=false;
        		bool is_enum=false;
        		if (parameters.expressions.Count == 2) 
        		{
        			param1 = convert_strong(parameters.expressions[1]);
        			param1 = convertion_data_and_alghoritms.convert_type(param1,SystemLibrary.SystemLibrary.integer_type);
        		}
        		basic_function_call ass = null;
        		basic_function_call bfc = null;
        		if (param0.type == SystemLibrary.SystemLibrary.integer_type)
        		{
        			ass = new basic_function_call(SystemLibrary.SystemLibrary.int_assign as basic_function_node,loc);
        			bfc = new basic_function_call(SystemLibrary.SystemLibrary.int_sub as basic_function_node,loc);
        		}
        		else if (param0.type == SystemLibrary.SystemLibrary.char_type)
        		{
        			ass = new basic_function_call(SystemLibrary.SystemLibrary.char_assign as basic_function_node,loc);
        			bfc = new basic_function_call(SystemLibrary.SystemLibrary.int_sub as basic_function_node,loc);
        		}
        		else if (param0.type == SystemLibrary.SystemLibrary.byte_type)
        		{
        			ass = new basic_function_call(SystemLibrary.SystemLibrary.byte_assign as basic_function_node,loc);
        			bfc = new basic_function_call(SystemLibrary.SystemLibrary.int_sub as basic_function_node,loc);
        		}
        		else if (param0.type == SystemLibrary.SystemLibrary.sbyte_type)
//.........这里部分代码省略.........
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:101,代码来源:syntax_tree_visitor.cs

示例13: get_init_call_for_binary_file

        internal expression_node get_init_call_for_binary_file(var_definition_node vdn)
        {
            location loc = null;
            if (vdn.type is common_type_node)
                loc = (vdn.type as common_type_node).loc;
            if (!SystemUnitAssigned)
                AddError(new NotSupportedError(loc));
            type_node tn = vdn.type;
            vdn.type = SystemLibrary.SystemLibInitializer.BinaryFileType.sym_info as type_node;

            expression_node var_ref = create_variable_reference(vdn, loc);
            expressions_list exl = new expressions_list();
            exl.AddElement(var_ref);

            function_node fn = convertion_data_and_alghoritms.select_function(exl, SystemLibrary.SystemLibInitializer.BinaryFileInitProcedure.SymbolInfo, loc);
            expression_node expr = convertion_data_and_alghoritms.create_simple_function_call(fn, null, exl.ToArray());

            vdn.type = tn;

            return expr;
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:21,代码来源:syntax_tree_visitor.cs

示例14: make_read_call

        private expression_node make_read_call(SymbolInfo si, SyntaxTree.expression_list parameters, location loc)
        {

            // вызов read(a,b,c) разбивается на несколько вызовов, последний возвращается узлом, а остальные добавляются здесь в теле            expressions_list exl = new expressions_list();
            expression_node last_call = null;
            expressions_list exl = new expressions_list();
            expression_node file = null;
            bool read_from_file = false;
            bool read_from_text_file = false;
            bool read_from_typed_file = false;
            bool read_from_binary_file = false;
            bool readln_string_file = false;
            if (parameters != null) // если список параметров не пуст
            {
                if (parameters.expressions.Count >= 1)
                {
                    expression_node param0 = convert_strong(parameters.expressions[0]);
                    if (param0.type != null)
                    {
                        if (SystemLibrary.SystemLibInitializer.TextFileType.Found && param0.type == SystemLibrary.SystemLibInitializer.TextFileType.sym_info)
                        {
                            file = param0;
                            read_from_text_file = true;
                        }
                        if (param0.type.type_special_kind == SemanticTree.type_special_kind.typed_file
                            && parameters.expressions.Count > 1                        //это можно внести во внутрь
                            )//и побросать приличные исключения
                        {
                            if (!SystemLibrary.SystemLibInitializer.read_procedure.FromDll)
                            {
                                if (si == SystemLibrary.SystemLibInitializer.read_procedure.SymbolInfo)
                                {
                                    file = param0;
                                    read_from_typed_file = true;
                                }
                            }
                            else if (SystemLibrary.SystemLibInitializer.read_procedure.Equal(si))
                            {
                                file = param0;
                                read_from_typed_file = true;
                            }
                        }
                        if (param0.type.type_special_kind == SemanticTree.type_special_kind.binary_file
                            && parameters.expressions.Count > 1                        //это можно внести во внутрь
                            )//и побросать приличные исключения
                        {
                            if (!SystemLibrary.SystemLibInitializer.read_procedure.FromDll)
                            {
                                if (si == SystemLibrary.SystemLibInitializer.read_procedure.SymbolInfo)
                                {
                                    file = param0;
                                    read_from_binary_file = true;
                                }
                            }
                            else if (SystemLibrary.SystemLibInitializer.read_procedure.Equal(si))
                            {
                                file = param0;
                                read_from_binary_file = true;
                            }
                        }
                    }
                    read_from_file = read_from_text_file || read_from_typed_file || read_from_binary_file;
                }
                bool first_iteration = true;
                
                foreach (SyntaxTree.expression ex in parameters.expressions)
                {
                    if (first_iteration && read_from_file)
                    {
                        first_iteration = false;
                        continue;
                    }
                    if (last_call != null && convertion_data_and_alghoritms.statement_list_stack.size > 0)
                        convertion_data_and_alghoritms.statement_list_stack.top().statements.AddElement(last_call);
                    expression_node en = convert_strong(ex);
                    check_on_loop_variable(en);
                    //if (en.type == null)
                    //throw new CanNotRead(en.location);
                    exl.clear();
                    if (read_from_file)
                        exl.AddElement(file);
                    if (read_from_typed_file)
                    {
                        if (SystemLibrary.SystemLibInitializer.TypedFileReadProcedure == null)
                            AddError(new NotSupportedError(loc));
                        if (en.type != file.type.element_type)
                            AddError(new ExpectedExprHaveTypeTypedFile(file.type.element_type, en.type, true, get_location(ex)));
                        bool is_char_getter = false;
                        if (!en.is_addressed)
                        {
                            if (en is compiled_function_call)
                            {
                                compiled_function_call cfc = en as compiled_function_call;
                                
                                if ((cfc.function_node.return_value_type == SystemLibrary.SystemLibrary.char_type && cfc.function_node.cont_type == SystemLibrary.SystemLibrary.string_type
                                      && cfc.function_node == cfc.function_node.cont_type.default_property_node.get_function))
                                {
                                    en = new simple_array_indexing((en as compiled_function_call).obj, (en as compiled_function_call).parameters[0], SystemLibrary.SystemLibrary.char_type, en.location);
                                    is_char_getter = true;
                                }
//.........这里部分代码省略.........
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:101,代码来源:syntax_tree_visitor.cs

示例15: get_init_call_for_set_as_constr

        internal expression_node get_init_call_for_set_as_constr(var_definition_node vdn, expression_node init_value)
        {
            location loc = (vdn.type as common_type_node).loc;
            if (!SystemUnitAssigned)
                AddError(new NotSupportedError(loc));
            //Когда заработает наследование конструкторов надо вставить это
            /*
            expression_node var_ref = create_variable_reference(vdn, loc);
            expressions_list exl = new expressions_list();
            exl.AddElement(new typeof_operator(element_type, loc));
            base_function_call bfc = create_constructor_call(vdn.type, exl, loc);
            expression_node expr = find_operator(compiler_string_consts.assign_name, var_ref, bfc, loc);
            */

            type_node tn = vdn.type;
            vdn.type = SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as type_node;

            expression_node var_ref = create_variable_reference(vdn, loc);
            expressions_list exl = new expressions_list();
            //exl.AddElement(var_ref);
            //exl.AddElement(new typeof_operator(element_type, loc));
            if (tn.element_type == SystemLibrary.SystemLibrary.byte_type)
            {
            	exl.AddElement(new byte_const_node(byte.MinValue,null));
            	exl.AddElement(new byte_const_node(byte.MaxValue,null));
            }
            else if (tn.element_type == SystemLibrary.SystemLibrary.sbyte_type)
            {
            	exl.AddElement(new sbyte_const_node(sbyte.MinValue,null));
            	exl.AddElement(new sbyte_const_node(sbyte.MaxValue,null));
            }
            else if (tn.element_type == SystemLibrary.SystemLibrary.short_type)
            {
            	exl.AddElement(new short_const_node(short.MinValue,null));
            	exl.AddElement(new short_const_node(short.MaxValue,null));
            }
            else if (tn.element_type == SystemLibrary.SystemLibrary.ushort_type)
            {
            	exl.AddElement(new ushort_const_node(ushort.MinValue,null));
            	exl.AddElement(new ushort_const_node(ushort.MaxValue,null));
            }
            else if (tn.element_type.type_special_kind == SemanticTree.type_special_kind.diap_type || tn.element_type.type_special_kind == SemanticTree.type_special_kind.enum_kind)
            {
            	ordinal_type_interface ii = tn.element_type.get_internal_interface(internal_interface_kind.ordinal_interface) as ordinal_type_interface;
            	exl.AddElement(ii.lower_value);
            	exl.AddElement(ii.upper_value);
            }
            exl.AddElement(init_value);
            function_node fn = null;
            if (exl.Count > 1)
            {
                fn = convertion_data_and_alghoritms.select_function(exl, (SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as type_node).find_in_type(compiler_string_consts.default_constructor_name), loc);
            }
            else
            {
                fn = convertion_data_and_alghoritms.select_function(exl, (SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as type_node).find_in_type(compiler_string_consts.default_constructor_name), loc);
            }
            //expression_node expr = convertion_data_and_alghoritms.create_simple_function_call(fn, null, exl.ToArray());
            expression_node expr = create_static_method_call_with_params(fn, loc, tn, false, exl);
            vdn.type = tn;

            return expr;
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:63,代码来源:syntax_tree_visitor.cs


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