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));
            }
 /// <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;
 }
 /// <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;
 }
Example #4
0
 public common_parameter(string name, type_node tp, 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;
 }
        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;

            /*if (ret_if_true is null_const_node)
             *  this.conversion_type = ret_if_false.conversion_type;
             * else
             *  this.conversion_type = ret_if_true.conversion_type;*/
        }
        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);
        }
 /// <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;
 }
 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;
 }
 public lock_statement(expression_node _lock_object, statement_node _body, location loc)
     : base(loc)
 {
     this._lock_object = _lock_object;
     this._body        = _body;
 }
Example #10
0
 public class_field_reference(class_field field, expression_node obj, location loc) :
     base(field.type, loc)
 {
     _field = field;
     _obj   = obj;
 }
 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;
 }
 public as_node(expression_node left, type_node right, location loc)
     : base(right, loc)
 {
     _left  = left;
     _right = right;
 }
 public statements_expression_node(statement_node_list statements, expression_node expression, location loc)
     : base(expression.type, loc)
 {
     this._statements_list = statements;
     this._expression      = expression;
 }
            public expression_node convert_delegates_to_delegates(location call_location, expression_node[] parameters)
            {
                if (parameters.Length != 1)
                {
                    throw new PascalSharp.Internal.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);

                SymbolInfo si = pr.type.find_first_in_type(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);
            }
 /// <summary>
 /// Конструктор узла.
 /// </summary>
 /// <param name="deref_expr">Выражение-указатель.</param>
 /// <param name="loc">Расположение выражения.</param>
 public dereference_node(expression_node deref_expr, location loc) :
     //base(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;
 }
 /// <summary>
 /// Конструктор класса.
 /// </summary>
 /// <param name="condition">Условие цикла.</param>
 /// <param name="loc">Расположение узла.</param>
 public while_node(expression_node condition, location loc)
     : base(loc)
 {
     _condition = condition;
 }
Example #17
0
 public compiled_function_call(compiled_function_node compiled_method, expression_node obj, location loc) :
     base(compiled_method, loc)
 {
     _obj = obj;
 }
Example #18
0
 public common_method_call(common_method_node method, expression_node obj, location loc)
     : base(method, loc)
 {
     _obj          = obj;
     _virtual_call = true;
 }
Example #19
0
 public throw_statement_node(expression_node exception, location loc) :
     base(loc)
 {
     _excpetion = exception;
 }
Example #20
0
 public compiled_variable_reference(compiled_variable_definition var, expression_node obj, location loc) :
     base(var.type, loc)
 {
     _var = var;
     _obj = obj;
 }
 /// <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;
 }
 public nonstatic_event_reference(expression_node obj, event_node en, location loc)
     : base(en, loc)
 {
     _obj = obj;
 }
 public non_static_property_reference(property_node pn, expression_node obj, location loc) :
     base(pn, loc)
 {
     _en = obj;
 }
 /// <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;
 }