Exemplo n.º 1
0
            public expression_node convert_delegate_to_return_value_type_with_convertion(location call_location, params expression_node[] parameters)
            {
                expression_node del = parameters[0];
                expression_node par = convert_delegate_to_return_value_type(call_location, del);

                return(type_table_function_call_maker(convert_function, call_location, par));
            }
Exemplo n.º 2
0
 /// <summary>
 /// Конструктор класса.
 /// </summary>
 /// <param name="condition">Условие.</param>
 /// <param name="then_body">Тело then.</param>
 /// <param name="else_body">Тело else.</param>
 /// <param name="loc">Расположение узла.</param>
 public if_node(expression_node condition, statement_node then_body, statement_node else_body, location loc) :
     base(loc)
 {
     _condition = condition;
     _then_body = then_body;
     _else_body = else_body;
 }
Exemplo n.º 3
0
 public double_question_colon_expression(expression_node condition, expression_node ret_if_null,
                                         location loc)
     : base(condition is null_const_node ? ret_if_null.type : condition.type, loc)
 {
     this._condition   = condition;
     this._ret_if_null = ret_if_null;
 }
Exemplo n.º 4
0
 public question_colon_expression(expression_node condition, expression_node ret_if_true, expression_node ret_if_false,
                                  location loc)
     : base(ret_if_true is null_const_node ? ret_if_false.type : ret_if_true.type, loc)
 {
     this._condition    = condition;
     this._ret_if_true  = ret_if_true;
     this._ret_if_false = ret_if_false;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Конструктор клааса.
 /// </summary>
 /// <param name="initialization_statement">Выражение инициализации переменной цикла.</param>
 /// <param name="while_expr">Условие цикла.</param>
 /// <param name="increment_statement">Выражение измененияя счетчика цикла.</param>
 /// <param name="body">Тело цикла.</param>
 public for_node(statement_node initialization_statement, expression_node while_expr, expression_node init_while_expr,
                 statement_node increment_statement, statement_node body, location loc) : base(loc)
 {
     _initialization_statement = initialization_statement;
     _while_expr          = while_expr;
     _init_while_expr     = init_while_expr;
     _increment_statement = increment_statement;
     _body = body;
 }
Exemplo n.º 6
0
 public common_parameter(string name, type_node tp, SemanticTree.parameter_type pt,
                         common_function_node cont_function, concrete_parameter_type conc_par_type, expression_node default_value,
                         location loc) :
     base(name, tp)
 {
     _par_type                = pt;
     _cont_function           = cont_function;
     _concrete_parameter_type = conc_par_type;
     _default_value           = default_value;
     _loc = loc;
 }
Exemplo n.º 7
0
        public static expression_node convert_delegate_to_return_value_type(location call_location, params expression_node[] parameters)
        {
            expression_node             par = parameters[0];
            internal_interface          ii  = par.type.get_internal_interface(internal_interface_kind.delegate_interface);
            delegate_internal_interface dii = (delegate_internal_interface)ii;
            common_method_node          cmn = dii.invoke_method as common_method_node;

            if (cmn != null)
            {
                expression_node exp = new common_method_call(cmn, par, call_location);
                return(exp);
            }
            compiled_function_node cfn = dii.invoke_method as compiled_function_node;

            if (cfn != null)
            {
                expression_node exp = new compiled_function_call(cfn, par, call_location);
                return(exp);
            }
            return(null);
        }
        private addressed_expression create_class_field_reference(expression_node en, definition_node dn, SyntaxTree.ident id_right)
        {
            try_convert_typed_expression_to_function_call(ref en);
            if (dn.semantic_node_type == semantic_node_type.class_field)
            {
                class_field cf = (class_field)dn;
                if (cf.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
                {
                    AddError(new CanNotReferanceToStaticFieldWithExpression(cf, get_location(id_right), en));
                }
                class_field_reference cfr = new class_field_reference(cf, en, get_location(id_right));
                //return_value(cfr);
                return cfr;
            }
            if (dn.semantic_node_type == semantic_node_type.compiled_variable_definition)
            {
                compiled_variable_definition cfd = (compiled_variable_definition)dn;
                if (cfd.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
                {
                    AddError(new CanNotReferanceToStaticFieldWithExpression(cfd, get_location(id_right), en));
                }
                compiled_variable_reference cfr2 = new compiled_variable_reference(cfd, en, get_location(id_right));
                //return_value(cfr2);
                return cfr2;
            }
#if (DEBUG)
            throw new CompilerInternalError("Invalid variable kind");
#endif
            return null;
        }
 private expression_node convert_if_typed_expression_to_function_call(expression_node expr)
 {
     if (expr is typed_expression)
         return convert_typed_expression_to_function_call(expr as typed_expression);
     return expr;
 }
 private void check_on_loop_variable(expression_node en)
 {
 	if (context.is_in_cycle() && !SemanticRules.AllowChangeLoopVariable)
 		if (en.semantic_node_type == semantic_node_type.namespace_variable_reference)
 		{
 			if (context.is_loop_variable((en as namespace_variable_reference).var))
                 AddError(en.location, "CANNOT_ASSIGN_TO_LOOP_VARIABLE");
 		}
 		else if (en.semantic_node_type == semantic_node_type.local_variable_reference)
 		{
 			if (context.is_loop_variable((en as local_variable_reference).var))
                 AddError(en.location, "CANNOT_ASSIGN_TO_LOOP_VARIABLE");
 		}
 		else if (en.semantic_node_type == semantic_node_type.local_block_variable_reference)
 		{
 			if (context.is_loop_variable((en as local_block_variable_reference).var))
                 AddError(en.location, "CANNOT_ASSIGN_TO_LOOP_VARIABLE");
 		}
 		
 }
 private expressions_list get_set_initializer(expression_node cnfc)
 {
     return set_intls[cnfc];
 }
Exemplo n.º 12
0
 public nonstatic_event_reference(expression_node obj, event_node en, location loc)
     : base(en, loc)
 {
     _obj = obj;
 }
Exemplo n.º 13
0
 private void CheckAssign(expression_node p)
 {
     switch (p.semantic_node_type)
     {
         case semantic_node_type.local_variable_reference: IncreaseNumAssVar((local_variable_reference)p); break;
         case semantic_node_type.namespace_variable_reference: IncreaseNumAssVar((namespace_variable_reference)p); break;
         case semantic_node_type.class_field_reference: VisitExpression((p as class_field_reference).obj); IncreaseNumAssField((class_field_reference)p); break;
         case semantic_node_type.static_class_field_reference: IncreaseNumAssField((static_class_field_reference)p); break;
         case semantic_node_type.common_parameter_reference: IncreaseNumAssParam((common_parameter_reference)p); break;
         case semantic_node_type.deref_node: CheckAssign(((dereference_node)p).deref_expr); break;
     }
 }
 private string_const_node convert_string_const_to_switch(expression_node switch_expr, location loc)
 {
     if (switch_expr is string_const_node)
         return switch_expr as string_const_node;
     string_const_node scn = null;
     if (switch_expr is static_compiled_variable_reference && (switch_expr as static_compiled_variable_reference).var.compiled_field.IsLiteral)
         scn = new string_const_node((string)(switch_expr as static_compiled_variable_reference).var.compiled_field.GetRawConstantValue(), loc);
     if (scn == null)
     {
         AddError(loc, "CONSTANT_EXPRESSION_EXPECTED");
     }
     return scn;
 }
Exemplo n.º 15
0
 public statements_expression_node(statement_node_list statements, expression_node expression, location loc)
     : base(expression.type, loc)
 {
     this._statements_list = statements;
     this._expression      = expression;
 }
Exemplo n.º 16
0
 public compiled_function_call(compiled_function_node compiled_method, expression_node obj, location loc) :
     base(compiled_method, loc)
 {
     _obj = obj;
 }
Exemplo n.º 17
0
 public common_method_call(common_method_node method, expression_node obj, location loc)
     : base(method, loc)
 {
     _obj          = obj;
     _virtual_call = true;
 }
Exemplo n.º 18
0
 public compiled_variable_reference(compiled_variable_definition var, expression_node obj, location loc) :
     base(var.type, loc)
 {
     _var = var;
     _obj = obj;
 }
Exemplo n.º 19
0
 public class_field_reference(class_field field, expression_node obj, location loc) :
     base(field.type, loc)
 {
     _field = field;
     _obj   = obj;
 }
 private void return_value(expression_node expr)
 {
     ret.return_value(expr);
 }
Exemplo n.º 21
0
            public expression_node convert_delegates_to_delegates(location call_location, expression_node[] parameters)
            {
                if (parameters.Length != 1)
                {
                    throw new PascalABCCompiler.TreeConverter.CompilerInternalError("Invalid delegates convertion");
                }
                delegate_internal_interface dii_to =
                    (delegate_internal_interface)_to.get_internal_interface(internal_interface_kind.delegate_interface);
                delegate_internal_interface dii =
                    (delegate_internal_interface)parameters[0].type.get_internal_interface(internal_interface_kind.delegate_interface);

                expression_node pr = parameters[0];

                base_function_call ifnotnull = null;

                if (_to.semantic_node_type == semantic_node_type.compiled_type_node)
                {
                    ifnotnull = new compiled_constructor_call((compiled_constructor_node)dii_to.constructor, call_location);
                }
                else
                {
                    ifnotnull = new common_constructor_call((common_method_node)dii_to.constructor, call_location);
                }
                //ccc = new common_constructor_call(dii_to.constructor, call_location);

                expression_node par = null;

                if (parameters[0].type.semantic_node_type == semantic_node_type.compiled_type_node)
                {
                    par = new compiled_function_call((compiled_function_node)dii.invoke_method, parameters[0], call_location);
                }
                else
                {
                    par = new common_method_call((common_method_node)dii.invoke_method, parameters[0], call_location);
                }
                ifnotnull.parameters.AddElement(par);

                null_const_node ncn  = new null_const_node(_to, call_location);
                null_const_node ncn2 = new null_const_node(_to, call_location);

                PascalABCCompiler.TreeConverter.SymbolInfo si = pr.type.find_first_in_type(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name);

                basic_function_node fn        = si.sym_info as basic_function_node;
                expression_node     condition = null;

                if (fn != null)
                {
                    basic_function_call condition_bfc = new basic_function_call(fn, call_location);
                    condition_bfc.parameters.AddElement(pr);
                    condition_bfc.parameters.AddElement(ncn);
                    condition = condition_bfc;
                }
                else if (si.sym_info is compiled_function_node)
                {
                    compiled_static_method_call condition_cfc = new compiled_static_method_call(si.sym_info as compiled_function_node, call_location);
                    condition_cfc.parameters.AddElement(pr);
                    condition_cfc.parameters.AddElement(ncn);
                    condition = condition_cfc;
                }

                question_colon_expression qce = new question_colon_expression(condition, ncn2, ifnotnull, call_location);

                return(qce);
            }
 private addressed_expression address_expression_reciving(SyntaxTree.ident id_right, SymbolInfo si,
     expression_node en)
 {
     if (si != null && si.sym_info != null &&
         si.sym_info.semantic_node_type == semantic_node_type.indefinite_definition_node)
     {
         return new indefinite_reference(si.sym_info as indefinite_definition_node, get_location(id_right));
     }
 	definition_node dn = null;
 	if (!internal_is_assign)
         dn = context.check_name_node_type(id_right.name, si, get_location(id_right),
         general_node_type.variable_node, general_node_type.property_node, general_node_type.event_node);
     else
         dn = context.check_name_node_type(id_right.name, si, get_location(id_right),
         general_node_type.variable_node, general_node_type.property_node, general_node_type.event_node, general_node_type.constant_definition);
     if (dn.general_node_type == general_node_type.constant_definition)
     {
         AddError(get_location(id_right), "CAN_NOT_ASSIGN_TO_CONSTANT_OBJECT");
     }
     switch (dn.general_node_type)
     {
         case general_node_type.variable_node:
             {
                 return create_class_field_reference(en, dn, id_right);
             }
         case general_node_type.property_node:
             {
                 property_node pn = (property_node)dn;
                 if (pn.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
                 {
                     AddError(new CanNotReferenceToStaticPropertyWithExpression(pn, get_location(id_right), pn.comprehensive_type));
                 }
                 try_convert_typed_expression_to_function_call(ref en);
                 non_static_property_reference pr = new non_static_property_reference(pn, en, get_location(id_right));
                 return pr;
             }
         case general_node_type.event_node:
             {
                 if (dn.semantic_node_type == semantic_node_type.compiled_event)
                 {
                     compiled_event ce = (compiled_event)dn;
                     if (ce.is_static)
                     {
                         //throw new NonStaticAndStaticEvevnt();
                     }
                     nonstatic_event_reference ser = new nonstatic_event_reference(en, ce, get_location(id_right));
                     return ser;
                 }
                 else if (dn.semantic_node_type == semantic_node_type.common_event)
                 {
                     common_event ce = (common_event)dn;
                     if (ce.is_static)
                     {
                         //throw new NonStaticAndStaticEvevnt();
                     }
                     nonstatic_event_reference ser = new nonstatic_event_reference(en, ce, get_location(id_right));
                     return ser;
                 }
                 break;
             }
     	default : return null;
     }
     throw new CompilerInternalError("Undefined expression to address reciving");
 }
Exemplo n.º 23
0
 public foreach_node(var_definition_node _ident, expression_node _in_what, statement_node _what_do, location loc) : base(loc)
 {
     this._ident   = _ident;
     this._in_what = _in_what;
     this._what_do = _what_do;
 }
Exemplo n.º 24
0
 public throw_statement_node(expression_node exception, location loc) :
     base(loc)
 {
     _excpetion = exception;
 }
Exemplo n.º 25
0
 public lock_statement(expression_node _lock_object, statement_node _body, location loc)
     : base(loc)
 {
     this._lock_object = _lock_object;
     this._body        = _body;
 }
Exemplo n.º 26
0
 private RetVal GetConstantValue(expression_node en)
 {
     if (en is bool_const_node)
     {
         if ((en as bool_const_node).constant_value) return RetVal.True;
         else return RetVal.False;
     }
     else return RetVal.Undef;
 }
Exemplo n.º 27
0
 public as_node(expression_node left, type_node right, location loc)
     : base(right, loc)
 {
     _left  = left;
     _right = right;
 }
 internal expression_node make_assign_operator(addressed_expression left, expression_node right, location loc)
 {
     return find_operator(compiler_string_consts.assign_name, left, right, loc);
 }
Exemplo n.º 29
0
 /// <summary>
 /// Конструктор класса.
 /// </summary>
 /// <param name="condition">Условие цикла.</param>
 /// <param name="loc">Расположение узла.</param>
 public while_node(expression_node condition, location loc)
     : base(loc)
 {
     _condition = condition;
 }
 private void add_set_initializer(expression_node cnfc, expressions_list exprs)
 {
     set_intls[cnfc] = exprs;
 }
Exemplo n.º 31
0
 /// <summary>
 /// Конструктор класса.
 /// </summary>
 /// <param name="condition">Условие цикла.</param>
 /// <param name="body">Тело цикла.</param>
 /// <param name="loc">Расположение узла.</param>
 public while_node(expression_node condition, statement_node body, location loc) : base(loc)
 {
     _condition = condition;
     _body      = body;
 }
		private expression_node create_with_expression(expression_node expr)
		{
			location sl = expr.location;
			switch (expr.semantic_node_type)
			{
				case semantic_node_type.common_namespace_function_call:
				case semantic_node_type.common_in_function_function_call:
				case semantic_node_type.common_method_call:
				case semantic_node_type.common_static_method_call:
				case semantic_node_type.compiled_function_call:
				case semantic_node_type.compiled_constructor_call:
				case semantic_node_type.common_constructor_call:
				case semantic_node_type.compiled_static_method_call:
					return convertion_data_and_alghoritms.CreateVariableReference(context.add_var_definition(compiler_string_consts.GetTempVariableName(), sl, expr.type, expr), sl);
				case semantic_node_type.class_field_reference:
					(expr as class_field_reference).obj = create_with_expression((expr as class_field_reference).obj);
					return expr;
				case semantic_node_type.compiled_variable_reference:
					(expr as compiled_variable_reference).obj = create_with_expression((expr as compiled_variable_reference).obj);
					return expr;
				case semantic_node_type.simple_array_indexing:
					simple_array_indexing sar = expr as simple_array_indexing;
					sar.simple_arr_expr = create_with_expression(sar.simple_arr_expr);
					sar.ind_expr = create_with_expression(sar.ind_expr);
					return sar;
				case semantic_node_type.deref_node:
					(expr as dereference_node).deref_expr = create_with_expression((expr as dereference_node).deref_expr);
					return expr;
				case semantic_node_type.basic_function_call:
					return convertion_data_and_alghoritms.CreateVariableReference(context.add_var_definition(compiler_string_consts.GetTempVariableName(), sl, expr.type, expr), sl);
				case semantic_node_type.as_node:
					return convertion_data_and_alghoritms.CreateVariableReference(context.add_var_definition(compiler_string_consts.GetTempVariableName(), sl, expr.type, expr), sl);
			}
			return expr;
		}
Exemplo n.º 33
0
 /// <summary>
 /// Конструктор узла.
 /// </summary>
 /// <param name="body">Тело цикла.</param>
 /// <param name="condition">Условие.</param>
 /// <param name="loc">Расположение узла.</param>
 public repeat_node(statement_node body, expression_node condition, location loc) : base(loc)
 {
     _body      = body;
     _condition = condition;
 }
 private void try_convert_typed_expression_to_function_call(ref expression_node en)
 {
     if (en.semantic_node_type == semantic_node_type.typed_expression)
     {
         en = convert_typed_expression_to_function_call((typed_expression)en);
     }
 }
        private expression_node find_operator(SyntaxTree.Operators ot, expression_node expr, location loc)
        {
            string name = name_reflector.get_name(ot);
            //#if (DEBUG)
            if (name == null)
            {
                if (ot == PascalABCCompiler.SyntaxTree.Operators.AddressOf)
                {
                    if (expr.is_addressed == false)
                    {
                        AddError(expr.location, "CAN_NOT_GET_ADDRESS_FROM_EXPRESSION");
                    }
                    expression_node res = new get_addr_node(expr, loc);
                    return res;
                }
                if (ot == PascalABCCompiler.SyntaxTree.Operators.Dereference)
                {
                }
                throw new CompilerInternalError("Invalid operator name");
            }
            //#endif
            SymbolInfo si = expr.type.find(name, context.CurrentScope);
            if (si == null || si.sym_info is wrapped_definition_node)
            {
            	AddError(new OperatorCanNotBeAppliedToThisType(name, expr));
            }

            expressions_list pars = new expressions_list();
            pars.AddElement(expr);

            function_node fn = convertion_data_and_alghoritms.select_function(pars, si, loc);
            expr = pars[0];
            if (fn == null)
            {
            	AddError(new OperatorCanNotBeAppliedToThisType(name, expr));
            }
#if (DEBUG)
            convertion_data_and_alghoritms.check_operator(fn);
#endif
            expression_node exp_node = convertion_data_and_alghoritms.create_simple_function_call(fn, loc, expr);
            return exp_node;
        }
 private base_function_call create_not_static_method_call(function_node fn, expression_node en, location loc, bool procedure_allowed)
 {
     try_convert_typed_expression_to_function_call(ref en);
     if ((!procedure_allowed) && (fn.return_value_type == null))
     {
         AddError(loc, "FUNCTION_EXPECTED_PROCEDURE_{0}_MEET", fn);
     }
     if (fn.semantic_node_type == semantic_node_type.common_method_node)
     {
         common_method_node cmn = (common_method_node)fn;
         if (cmn.is_constructor)
         {
             AddError(loc, "CAN_NOT_CALL_CONSTRUCTOR_AS_PROCEDURE");
         }
         if (cmn.original_function != null && cmn.original_function is compiled_function_node && (cmn.original_function as compiled_function_node).ConnectedToType != null)
         {
             common_static_method_call csmc = new common_static_method_call(cmn, loc);
             return csmc;
         }
         if (cmn.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
         {
             AddError(new CanNotCallStaticMethodWithExpression(en, fn));
         }
         
         common_method_call cmc = new common_method_call(cmn, en, loc);
         cmc.virtual_call = !inherited_ident_processing;
         return cmc;
     }
     if (fn.semantic_node_type == semantic_node_type.compiled_function_node)
     {
         compiled_function_node cfn = (compiled_function_node)fn;
         if (cfn.ConnectedToType != null)
         {
             compiled_static_method_call csmc = new compiled_static_method_call(cfn, loc);
             return csmc;
         }
         else
         {
             if (cfn.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
             {
                 if (!cfn.is_extension_method)
                     AddError(new CanNotCallStaticMethodWithExpression(en, fn));
                 else
                     return new compiled_static_method_call(cfn, loc);
             }
             compiled_function_call cfc = new compiled_function_call(cfn, en, loc);
             cfc.virtual_call = !inherited_ident_processing;
             return cfc;
         }
     }
     if (fn.semantic_node_type == semantic_node_type.compiled_constructor_node)
     {
         AddError(loc, "CAN_NOT_CALL_CONSTRUCTOR_AS_PROCEDURE");
     }
     if (fn.semantic_node_type == semantic_node_type.common_namespace_function_node && (fn as common_namespace_function_node).ConnectedToType != null)
     {
     	common_namespace_function_call cnfc = new common_namespace_function_call(fn as common_namespace_function_node,loc);
     	//cnfc.parameters.AddElement(en);
     	return cnfc;
     }
     if (fn.semantic_node_type == semantic_node_type.indefinite_definition_node)
     {
         indefinite_function_call ifc = new indefinite_function_call(fn, loc);
         return ifc;
     }
     throw new CompilerInternalError("Invalid method kind");
 }
Exemplo n.º 37
0
        private static expression_node inc_value_compile_time_executor(location call_location, expression_node[] expr)
        {
            return null;
            /*
            if (expr.Length != 1)
            {
                return null;
            }
            expression_node value_to_inc = expr[0];
            internal_interface ii=value_to_inc.type.get_internal_interface(internal_interface_kind.ordinal_interface);
            if (ii == null)
            {
                throw new CompilerInternalError("This method must be called only with ordinal types.");
            }
            ordinal_type_interface oti = (ordinal_type_interface)ii;
            constant_node cn = value_to_inc as constant_node;
            if (cn != null)
            {
                if (compare_ordinal_type(cn, oti.upper_value, oti.greater_eq_method.compile_time_executor,call_location))
                {
                    throw new CanNotIncrementOrdinalTypeValue(cn);
                }
                return (oti.internal_inc_value.compile_time_executor(call_location,cn));
            }
            else
            {

            }
            */
        }
 private expression_node expression_value_reciving(SyntaxTree.ident id_right, SymbolInfo si, expression_node en, bool expected_delegate)
 {
     definition_node dn = context.check_name_node_type(id_right.name, si, get_location(id_right), general_node_type.variable_node,
         general_node_type.function_node, general_node_type.property_node, general_node_type.constant_definition);
     switch (dn.general_node_type)
     {
         /*case general_node_type.constant_defenition:
         {
             constant_definition_node cdn=(constant_definition_node)dn;
             return cdn.const_value;
         }*/
         case general_node_type.variable_node:
             {
                 return create_class_field_reference(en, dn, id_right);
             }
         case general_node_type.function_node:
             {
                 if (dn.semantic_node_type == semantic_node_type.indefinite_definition_node)
                 {
                     return new indefinite_reference(dn as indefinite_definition_node, get_location(id_right));
                 }
                 if (expected_delegate)
                     return make_delegate_wrapper(en, si, get_location(id_right), false);
                 else
                 {
                     function_node fn = convertion_data_and_alghoritms.select_function(new expressions_list(),
                         si, get_location(id_right));
                     return create_not_static_method_call(fn, en, get_location(id_right), false);
                 }
             }
         case general_node_type.property_node:
             {
                 property_node pn = (property_node)dn;
                 if (pn.polymorphic_state == SemanticTree.polymorphic_state.ps_static)
                 {
                     AddError(new CanNotReferenceToStaticPropertyWithExpression(pn, get_location(id_right), pn.comprehensive_type));
                 }
                 function_node fn = pn.get_function;
                 if (fn == null)
                 {
                     AddError(new ThisPropertyCanNotBeReaded(pn, get_location(id_right)));
                 }
                 location lloc = get_location(id_right);
                 check_property_no_params(pn, lloc);
                 return create_not_static_method_call(fn, en, lloc, false);
             }
         case general_node_type.constant_definition:
             {
                 //throw new ConstMemberCannotBeAccessedWithAnInstanceReference((class_constant_definition)dn, get_location(id_right));
                 return ((constant_definition_node)dn).const_value;
             }
     }
     throw new CompilerInternalError("Invalid class member");
 }
Exemplo n.º 39
0
 internal static expression_node delegated_empty_method(location call_loc,expression_node[] expr)
 {
     if (expr.Length != 1)
     {
         return null;
     }
     return expr[0];
 }
        private void dot_node_as_expression_dot_ident(expression_node en, SyntaxTree.ident id_right, motivation mot, addressed_value syntax_node)
        {
            if (en is typed_expression)
                try_convert_typed_expression_to_function_call(ref en);
            SymbolInfo si = en.type.find_in_type(id_right.name, context.CurrentScope);
            if (si == null)
            {
                AddError(new MemberIsNotDeclaredInType(id_right, get_location(id_right), en.type));
            }

            try_convert_typed_expression_to_function_call(ref en);

            /*
            if (en.semantic_node_type == semantic_node_type.typed_expression)
            {
                type_node tn11=en.type;
                delegated_methods dm11=tn11 as delegated_methods;
                if (dm11!=null)
                {
                    en = dm11.empty_param_method;
                }
            }
            */

            switch (mot)
            {
                case motivation.address_reciving:
                    {
                        return_addressed_value(address_expression_reciving(id_right, si, en));
                        return;
                    }
                case motivation.expression_evaluation:
                    {
                        //en = expression_value_reciving(id_right, si, en, true);
            			//try_convert_typed_expression_to_function_call(ref en);
            			//return_value(en);
                        if (si.sym_info is function_node && (si.sym_info as function_node).is_extension_method)
                        {
                            dot_node dnode = new dot_node(syntax_node, id_right);
                            method_call mc = new method_call(dnode, new expression_list());
                            mc.visit(this);
                            return;
                        }
                        return_value(expression_value_reciving(id_right, si, en, true));
                        return;
                    }
                case motivation.semantic_node_reciving:
                    {
                        return_semantic_value(expression_value_reciving(id_right, si, en, true));
                        return;
                    }
            }
            throw new CompilerInternalError("Invalid motivation.");
        }
        private void FixupExpressionPosition(expression_node expr)
        {
        	List<int> poses = exprs_cache[expr];
        	//System.Diagnostics.Debug.WriteLine(pos);
        	foreach (int pos in poses)
        	{
        		int tmp = (int)bw.BaseStream.Position;
				bw.Seek(pos,SeekOrigin.Begin);
				bw.Write(tmp);
				bw.Seek(tmp,SeekOrigin.Begin);
        	}
        }
        private int_const_node convert_const_to_switch(expression_node switch_expr,
            ordinal_type_interface oti, type_node case_expr_type, location loc)
        {
            convertion_data_and_alghoritms.convert_type(switch_expr, case_expr_type, loc);
            if (switch_expr is int_const_node)
                return switch_expr as int_const_node;
            //switch_expr = convertion_data_and_alghoritms.create_simple_function_call(oti.value_to_int,
            //    loc, switch_expr);
            int_const_node icn = null;//switch_expr as constant_node;

            if (switch_expr is byte_const_node)
                icn = new int_const_node((switch_expr as byte_const_node).constant_value, loc);
            else if (switch_expr is sbyte_const_node)
                icn = new int_const_node(Convert.ToInt32((switch_expr as sbyte_const_node).constant_value), loc);
            else if (switch_expr is short_const_node)
                icn = new int_const_node(Convert.ToInt32((switch_expr as short_const_node).constant_value), loc);
            else if (switch_expr is ushort_const_node)
                icn = new int_const_node(Convert.ToInt32((switch_expr as ushort_const_node).constant_value), loc);
            /*else if (switch_expr is uint_const_node)
                icn = new int_const_node(Convert.ToInt32((switch_expr as uint_const_node).constant_value),loc);
            else if (switch_expr is long_const_node)
                icn = new int_const_node(Convert.ToInt32((switch_expr as long_const_node).constant_value),loc);
            else if (switch_expr is ulong_const_node)
                icn = new int_const_node(Convert.ToInt32((switch_expr as ulong_const_node).constant_value),loc);*/
            else if (switch_expr is bool_const_node)
                icn = new int_const_node(Convert.ToInt32((switch_expr as bool_const_node).constant_value), loc);
            else if (switch_expr is char_const_node)
                icn = new int_const_node(Convert.ToInt32((switch_expr as char_const_node).constant_value), loc);
            else if (switch_expr is enum_const_node)
                icn = new int_const_node((switch_expr as enum_const_node).constant_value, loc);
            else if (switch_expr is static_compiled_variable_reference && (switch_expr as static_compiled_variable_reference).var.compiled_field.IsLiteral)
                icn = new int_const_node((int)(switch_expr as static_compiled_variable_reference).var.compiled_field.GetRawConstantValue(), loc);

            //учти здесь модет быть и long!
            //-DarkStar Add
            if (icn == null)
            {
                AddError(loc, "CONSTANT_EXPRESSION_EXPECTED");
            }
            return icn;
        }
Exemplo n.º 43
0
 public is_node(expression_node left, type_node right, location loc)
     : base(compiled_type_node.get_type_node(typeof(bool)), loc)
 {
     _left  = left;
     _right = right;
 }
Exemplo n.º 44
0
		public return_node(expression_node return_expr,location loc) : base(loc)
		{
			_return_expr=return_expr;
		}
Exemplo n.º 45
0
 /// <summary>
 /// Конструктор узла.
 /// </summary>
 /// <param name="addr_of">Выражение, адрес которого мы получаем.</param>
 /// <param name="loc">Расположение узла.</param>
 public get_addr_node(expression_node addr_of, location loc) :
     base(addr_of.type.ref_type, loc)
 {
     _addr_of = addr_of;
 }
Exemplo n.º 46
0
 private static expression_node dec_compile_time_executor(location call_location, expression_node[] expr)
 {
     return null;
 }
Exemplo n.º 47
0
 /// <summary>
 /// Конструктор узла.
 /// </summary>
 /// <param name="deref_expr">Выражение-указатель.</param>
 /// <param name="loc">Расположение выражения.</param>
 public dereference_node(expression_node deref_expr, location loc) :
     //base(PascalABCCompiler.SystemLibrary.SystemLibrary.get_pointed_type_by_type(deref_expr.type),loc)
     base((deref_expr.type as ref_type_node).pointed_type, loc)
 {
     _deref_expr = deref_expr;
 }
 private void SaveExpressionAndOffset(expression_node expr)
 {
 	List<int> lst = null;
 	if (!exprs_cache.ContainsKey(expr))
 	{
 		lst = new List<int>();
 		exprs_cache[expr] = lst;
 	}
 	else lst = exprs_cache[expr];
 	lst.Add((int)bw.BaseStream.Position);
 	//System.Diagnostics.Debug.WriteLine((int)bw.BaseStream.Position);
 }
 private void check_expression_for_assign(expression_node expr, location loc)
 {
 	if (expr is namespace_constant_reference || expr is function_constant_reference)
         AddError(loc, "LEFT_SIDE_CANNOT_BE_ASSIGNED_TO");
 	else if (expr is class_field_reference) check_field_reference_for_assign(expr as class_field_reference,loc);
 	else if (expr is simple_array_indexing) check_expression_for_assign((expr as simple_array_indexing).simple_arr_expr,loc);
 }
Exemplo n.º 50
0
 public non_static_property_reference(property_node pn, expression_node obj, location loc) :
     base(pn, loc)
 {
     _en = obj;
 }
 private expression_node clip_expression_if_need(expression_node expr, type_node tn)
 {
 	if (!(tn is short_string_type_node) && tn.type_special_kind != SemanticTree.type_special_kind.set_type)
 		return expr;
 	if (tn is short_string_type_node)
 	{
 		return convertion_data_and_alghoritms.create_simple_function_call(SystemLibrary.SystemLibInitializer.ClipShortStringProcedure.sym_info as function_node,null,convertion_data_and_alghoritms.convert_type(expr,SystemLibrary.SystemLibrary.string_type),new int_const_node((tn as short_string_type_node).Length,null));
 	}
     else if (tn.type_special_kind == SemanticTree.type_special_kind.set_type && tn.element_type != null)
     {
         ordinal_type_interface oti = tn.element_type.get_internal_interface(internal_interface_kind.ordinal_interface) as ordinal_type_interface;
         if (oti != null)
         {
             base_function_call cmc = null;
             if (SystemLibrary.SystemLibInitializer.ClipFunction.sym_info is common_namespace_function_node)
                 cmc = new common_namespace_function_call(SystemLibrary.SystemLibInitializer.ClipFunction.sym_info as common_namespace_function_node, null);
             else
                 cmc = new compiled_static_method_call(SystemLibrary.SystemLibInitializer.ClipFunction.sym_info as compiled_function_node, null);
             cmc.parameters.AddElement(expr);
             cmc.parameters.AddElement(oti.lower_value.get_constant_copy(null));
             cmc.parameters.AddElement(oti.upper_value.get_constant_copy(null));
             cmc.ret_type = tn;
             return cmc;
         }
         else if (tn.element_type.type_special_kind == SemanticTree.type_special_kind.short_string)
         {
             base_function_call cmc = null;
             if (SystemLibrary.SystemLibInitializer.ClipShortStringInSetFunction.sym_info is common_namespace_function_node)
                 cmc = new common_namespace_function_call(SystemLibrary.SystemLibInitializer.ClipShortStringInSetFunction.sym_info as common_namespace_function_node, null);
             else
                 cmc = new compiled_static_method_call(SystemLibrary.SystemLibInitializer.ClipShortStringInSetFunction.sym_info as compiled_function_node, null);
             cmc.parameters.AddElement(expr);
             cmc.parameters.AddElement(new int_const_node((tn.element_type as short_string_type_node).Length, null));
             cmc.ret_type = tn;
             return cmc;
         }
     }
 	return expr;
 }
Exemplo n.º 52
0
 private void CheckType(type_node type, expression_node initial_value, location loc)
 {
     if (type.type_special_kind == SemanticTree.type_special_kind.array_wrapper)
     {
         AddHint("DO_NOT_USE_STATIC_ARRAYS", loc);
     }
     else if (type.IsPointer && type.element_type.is_value_type && type.element_type is common_type_node)
     {
         AddHint("DO_NOT_USE_POINTERS_TO_RECORDS", loc);
     }
     else if (type.type_special_kind == SemanticTree.type_special_kind.short_string)
     {
         AddHint("DO_NOT_USE_SHORT_STRINGS", loc);
     }
 }
 public override void visit(SyntaxTree.try_stmt _try_stmt)
 {
     context.enter_code_block_without_bind();
     context.enter_exception_handlers();
     statement_node try_statements = convert_strong(_try_stmt.stmt_list);
     context.leave_code_block();
     location loc = get_location(_try_stmt);
     exception_filters_list efl = new exception_filters_list();
     SyntaxTree.try_handler_except try_hand_except = _try_stmt.handler as SyntaxTree.try_handler_except;
     if (try_hand_except != null)
     {
         if (try_hand_except.except_block.handlers != null)
         {
             int hand_count = try_hand_except.except_block.handlers.handlers.Count;
             for (int i = 0; i < hand_count; i++)
             {
                 SyntaxTree.exception_handler eh = try_hand_except.except_block.handlers.handlers[i];
                 type_node filter_type = convert_strong(eh.type_name);
                 if (!SemanticRules.GenerateNativeCode && !(filter_type.is_generic_parameter ||
                     filter_type == SystemLibrary.SystemLibrary.exception_base_type ||
                     type_table.is_derived(SystemLibrary.SystemLibrary.exception_base_type, filter_type)))
                 {
                     AddError(get_location(eh.type_name), "EXCEPTION_TYPE_MUST_BE_SYSTEM_EXCEPTION_OR_DERIVED_FROM_EXCEPTION");
                 }
                 current_catch_excep = new int_const_node(2,null);//create_constructor_call(filter_type, new expressions_list(), null);
                 local_block_variable_reference lvr = null;
                 
                 context.enter_code_block_without_bind();
                 if (eh.variable != null)
                 {
                 	
                 	context.check_name_redefinition = false;
                 	
                 	local_block_variable lbv = context.add_var_definition(eh.variable.name, get_location(eh.variable), filter_type, SemanticTree.polymorphic_state.ps_common) as local_block_variable;
                     context.check_name_redefinition = true;
                 	lvr = new local_block_variable_reference(lbv, lbv.loc);
                 }
                 statement_node stm = convert_strong(eh.statements);
                 context.leave_code_block();
                 
                 /*if (eh.variable != null)
                 {
                     context.leave_scope();
                 }*/
                 exception_filter ef = new exception_filter(filter_type, lvr, stm, get_location(eh));
                 efl.AddElement(ef);
                 current_catch_excep = null;
             }
         }
         else
         {
             context.enter_code_block_without_bind();
             exception_filter ef = new exception_filter(null, null, convert_strong(try_hand_except.except_block.stmt_list), get_location(try_hand_except.except_block.stmt_list));
             context.leave_code_block();
             efl.AddElement(ef);
         }
         if (try_hand_except.except_block.else_stmt_list != null)
         {
             context.enter_code_block_without_bind();
             statement_node else_stm = convert_strong(try_hand_except.except_block.else_stmt_list);
             context.leave_code_block();
             type_node ftype = SystemLibrary.SystemLibrary.object_type;
             exception_filter else_ef = new exception_filter(ftype, null, else_stm, else_stm.location);
             efl.AddElement(else_ef);
         }
     }
     else
     {
     	type_node filter_type = compiled_type_node.get_type_node(NetHelper.NetHelper.FindType(compiler_string_consts.ExceptionName));
     	expression_node current_catch_excep = create_constructor_call(filter_type, new expressions_list(), null);
         local_block_variable_reference lvr = null;
         local_block_variable tmp_var = context.add_var_definition(context.BuildName("$try_temp" + UniqueNumStr()), null, SystemLibrary.SystemLibrary.bool_type, null) as local_block_variable;
         statements_list stm = new statements_list(null);
         SyntaxTree.try_handler_finally try_hndlr_finally = _try_stmt.handler as SyntaxTree.try_handler_finally;
         context.enter_code_block_without_bind();
         statement_node finally_stmt = convert_strong(try_hndlr_finally.stmt_list);
         context.leave_code_block();
         stm.statements.AddElement(finally_stmt);
         basic_function_call bfc = new basic_function_call(SystemLibrary.SystemLibrary.bool_not as basic_function_node,null);
         bfc.parameters.AddElement(new local_block_variable_reference(tmp_var,null));
         stm.statements.AddElement(new if_node(bfc,new rethrow_statement_node(null),null,null));
     	exception_filter ef = new exception_filter(filter_type, lvr, stm, null);
         efl.AddElement(ef);
         bfc = new basic_function_call(SystemLibrary.SystemLibrary.bool_assign as basic_function_node,null);
         bfc.parameters.AddElement(new local_block_variable_reference(tmp_var,null));
         bfc.parameters.AddElement(new bool_const_node(true,null));
         
         (try_statements as statements_list).statements.AddElement(bfc);
         (try_statements as statements_list).statements.AddElement(new throw_statement_node(current_catch_excep,null));
         return_value(new try_block(try_statements, null, efl, loc));
         context.leave_exception_handlers();
         return;
     }
     statement_node finally_st = null;
     SyntaxTree.try_handler_finally try_handler_finally = _try_stmt.handler as SyntaxTree.try_handler_finally;
     if (try_handler_finally != null)
     {
         context.enter_code_block_without_bind();
         finally_st = convert_strong(try_handler_finally.stmt_list);
         context.leave_code_block();
     }
     try_block tb = new try_block(try_statements, finally_st, efl, loc);
     context.leave_exception_handlers();
     return_value(tb);
 }
Exemplo n.º 54
0
 private void VisitExpression(expression_node en)
 {
     if (en == null) return;
     //WriteDebugInfo(en.location);
     switch (en.semantic_node_type)
     {
         case semantic_node_type.exit_procedure:
             /*ничего писать не надо*/
             break;
         case semantic_node_type.typeof_operator:
             //VisitTypeOfOperator((typeof_operator)en); 
             break;
         case semantic_node_type.statement_expression_node:
             VisitStatementsExpressionNode((statements_expression_node)en); break;
         case semantic_node_type.question_colon_expression:
             VisitQuestionColonExpression((question_colon_expression)en); break;
         case semantic_node_type.sizeof_operator:
             VisitSizeOfOperator((sizeof_operator)en); break;
         case semantic_node_type.is_node:
             VisitIsNode((is_node)en); break;
         case semantic_node_type.as_node:
             VisitAsNode((as_node)en); break;
         case semantic_node_type.compiled_static_method_call_node_as_constant:
             //VisitCompiledStaticMethodCallNodeAsConstant((compiled_static_method_call_as_constant)en); 
             break;
         case semantic_node_type.array_initializer:
             VisitArrayInitializer((array_initializer)en);
             break;
         case semantic_node_type.record_initializer:
             VisitRecordInitializer((record_initializer)en);
             break;
         case semantic_node_type.array_const:
             //VisitArrayConst((array_const)en);
             break;
         case semantic_node_type.record_const:
             //VisitRecordConst((record_constant)en); 
             break;
         case semantic_node_type.float_const_node:
             //VisitFloatConst((float_const_node)en); 
             break;
         case semantic_node_type.byte_const_node:
             //VisitByteConstNode((byte_const_node)en); 
             break;
         case semantic_node_type.int_const_node:
             //VisitIntConstNode((int_const_node)en); 
             break;
         case semantic_node_type.sbyte_const_node:
             //VisitSByteConstNode((sbyte_const_node)en); 
             break;
         case semantic_node_type.short_const_node:
             //VisitShortConstNode((short_const_node)en); 
             break;
         case semantic_node_type.ushort_const_node:
             //VisitUShortConstNode((ushort_const_node)en); 
             break;
         case semantic_node_type.uint_const_node:
             //VisitUIntConstNode((uint_const_node)en); 
             break;
         case semantic_node_type.ulong_const_node:
             //VisitULongConstNode((ulong_const_node)en); 
             break;
         case semantic_node_type.long_const_node:
             //VisitLongConstNode((long_const_node)en); 
             break;
         case semantic_node_type.double_const_node:
             //VisitDoubleConstNode((double_const_node)en); 
             break;
         case semantic_node_type.char_const_node:
             //VisitCharConstNode((char_const_node)en); 
             break;
         case semantic_node_type.bool_const_node:
             //VisitBoolConstNode((bool_const_node)en); 
             break;
         case semantic_node_type.string_const_node:
             //VisitStringConstNode((string_const_node)en); 
             break;
         case semantic_node_type.local_variable_reference:
             VisitLocalVariableReference((local_variable_reference)en); break;
         case semantic_node_type.namespace_variable_reference:
             VisitNamespaceVariableReference((namespace_variable_reference)en); break;
         case semantic_node_type.basic_function_call:
             VisitBasicFunctionCall((basic_function_call)en); break;
         case semantic_node_type.common_parameter_reference:
             VisitCommonParameterReference((common_parameter_reference)en); 
             break;
         case semantic_node_type.common_namespace_function_call:
             VisitCommonNamespaceFunctionCall((common_namespace_function_call)en); break;
         case semantic_node_type.basic_function_call_node_as_constant:
             VisitBasicFunctionCall((en as basic_function_call_as_constant).method_call); break;
         case semantic_node_type.common_namespace_function_call_node_as_constant:
             VisitCommonNamespaceFunctionCallAsConstant((common_namespace_function_call_as_constant)en); break;
         case semantic_node_type.common_in_function_function_call:
             VisitCommonInFuncFuncCall((common_in_function_function_call)en); break;
         case semantic_node_type.while_break_node:
             //VisitWhileBreakNode((while_break_node)en); 
             is_break_stmt = true;
             break;
         case semantic_node_type.while_continue_node:
             //VisitWhileContinueNode((while_continue_node)en); 
             is_break_stmt = true;
             break;
         case semantic_node_type.for_break_node:
             //VisitForBreakNode((for_break_node)en); 
             is_break_stmt = true;
             break;
         case semantic_node_type.for_continue_node:
             //VisitForContinueNode((for_continue_node)en); 
             is_break_stmt = true;
             break;
         case semantic_node_type.repeat_break_node:
             //VisitRepeatBreakNode((repeat_break_node)en);
             is_break_stmt = true;
             break;
         case semantic_node_type.repeat_continue_node:
             //VisitRepeatContinueNode((repeat_continue_node)en);
             is_break_stmt = true;
             break;
         case semantic_node_type.foreach_break_node:
             is_break_stmt = true;
             break;
         case semantic_node_type.foreach_continue_node:
             is_break_stmt = true;
             break;
         case semantic_node_type.common_static_method_call:
             VisitCommonStaticMethodCall((common_static_method_call)en); break;
         case semantic_node_type.compiled_static_method_call:
             VisitCompiledStaticMethodCall((compiled_static_method_call)en); break;
         case semantic_node_type.class_field_reference:
             VisitClassFieldReference((class_field_reference)en); 
             break;
         case semantic_node_type.deref_node:
             VisitDerefNode((dereference_node)en); break;
         case semantic_node_type.common_method_call:
             VisitCommonMethodCall((common_method_call)en); break;
         case semantic_node_type.compiled_function_call:
             VisitCompiledFunctionCall((compiled_function_call)en); break;
         case semantic_node_type.get_addr_node:
             VisitGetAddrNode((get_addr_node)en); break;
         case semantic_node_type.common_constructor_call:
             VisitCommonConstructorCall((common_constructor_call)en); break;
         case semantic_node_type.compiled_constructor_call:
             VisitCompiledConstructorCall((compiled_constructor_call)en); break;
         case semantic_node_type.compiled_variable_reference:
             VisitCompiledVariableReference((compiled_variable_reference)en); break;
         case semantic_node_type.local_block_variable_reference:
             VisitLocalBlockVariableReference((local_block_variable_reference)en); break;
         case semantic_node_type.static_compiled_variable_reference:
             //VisitStaticCompiledVariableReference((static_compiled_variable_reference)en); 
             break;
         case semantic_node_type.static_class_field_reference:
             VisitStaticClassFieldReference((static_class_field_reference)en); 
             break;
         case semantic_node_type.non_static_property_reference:
             VisitNonStaticPropertyReference((non_static_property_reference)en); break;
         case semantic_node_type.simple_array_indexing:
             VisitSimpleArrayIndexing((simple_array_indexing)en); break;
         case semantic_node_type.this_node:
             //VisitThisNode((this_node)en); 
             break;
         case semantic_node_type.null_const_node:
             //VisitNullConstNode((null_const_node)en); 
             break;
         //default: ;//Console.WriteLine(en.semantic_node_type); throw new Exception("Unknown expression");
     }
 }
        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;
        }