/* private static expression_node char_to_int(location call_location,expression_node[] expr) { if (expr.Length != 1) { return null; } if (expr[0].type != char_type) { return null; } char_const_node ccn = expr[0] as char_const_node; if (ccn == null) { return null; } return new int_const_node((int)ccn.constant_value, ccn.location); } */ private static basic_function_node create_emty_function(type_node ret_type, string name) { basic_function_node bfn = new basic_function_node(SemanticTree.basic_function_type.none, ret_type, true, name); basic_parameter par = new basic_parameter(compiler_string_consts.unary_param_name, ret_type, SemanticTree.parameter_type.value, bfn); bfn.parameters.AddElement(par); bfn.compile_time_executor = delegated_empty_method; add_stand_type(SemanticTree.basic_function_type.none, bfn); return bfn; }
public static basic_function_node make_generated_type_conversion(type_node from, type_node to, type_compare tc, SemanticTree.basic_function_type bft, bool is_implicit) { basic_function_node conv_method = new basic_function_node(bft, to, false); basic_parameter bp = new basic_parameter(compiler_string_consts.unary_param_name, from, SemanticTree.parameter_type.value, conv_method); conv_method.parameters.AddElement(bp); type_table.add_generated_type_conversion_from_defined(from, to, conv_method, tc, is_implicit); return conv_method; }
private static basic_function_node create_oti_method(SemanticTree.basic_function_type bft, type_node type, SemanticTree.parameter_type pt) { basic_function_node bfn = new basic_function_node(bft, type, true); basic_parameter cp = new basic_parameter(compiler_string_consts.unary_param_name, type, pt, bfn); bfn.parameters.AddElement(cp); //TODO: Важен порядок вызовов. add_stand_type(bft, bfn); return bfn; }
public static basic_function_node make_unary_operator(string operator_name, type_node to, SemanticTree.basic_function_type bft, type_node ret_value_type) { basic_function_node bfn = new basic_function_node(bft, ret_value_type,true); basic_parameter par = new basic_parameter(compiler_string_consts.unary_param_name, to, SemanticTree.parameter_type.value, bfn); bfn.parameters.AddElement(par); to.add_name(operator_name, new SymbolInfo(bfn)); add_stand_type(bft, bfn); return bfn; }
public static basic_function_node make_type_conversion(type_node from, type_node to, type_compare tc, SemanticTree.basic_function_type bft, bool is_implicit) { basic_function_node conv_method = new basic_function_node(bft, to,false); basic_parameter bp = new basic_parameter(compiler_string_consts.unary_param_name, from, SemanticTree.parameter_type.value, conv_method); conv_method.parameters.AddElement(bp); type_table.add_type_conversion_from_defined(from, to, conv_method, tc, is_implicit); //type_intersection_node inter_node = new type_intersection_node(tc); //inter_node.this_to_another = new type_conversion(conv_method,!is_implicit); //from.add_intersection_node(to, inter_node); add_stand_type(bft, conv_method); return conv_method; }
public static basic_function_node make_common_binary_operation(string operator_name, type_node def_type,type_node left,type_node right, SemanticTree.basic_function_type bft,type_node ret_value_type) { basic_function_node bfn = new basic_function_node(bft, ret_value_type,true,operator_name); basic_parameter par_left = new basic_parameter(compiler_string_consts.left_param_name, left, SemanticTree.parameter_type.value, bfn); basic_parameter par_right = new basic_parameter(compiler_string_consts.right_param_name, right, SemanticTree.parameter_type.value, bfn); bfn.parameters.AddElement(par_left); bfn.parameters.AddElement(par_right); def_type.add_name(operator_name, new SymbolInfo(bfn)); add_stand_type(bft, bfn); return bfn; }
private static basic_function_node make_unary_function(type_node param_type, SemanticTree.basic_function_type bft,type_node ret_val_type) { basic_function_node bfn = new basic_function_node(bft, ret_val_type, true); basic_parameter bpar = new basic_parameter(compiler_string_consts.unary_param_name, param_type, SemanticTree.parameter_type.value, bfn); bfn.parameters.AddElement(bpar); add_stand_type(bft, bfn); return bfn; }
private static basic_function_node make_object_operator(type_node ctn, SemanticTree.basic_function_type bas_ft, string name, type_node ret_type, SemanticTree.parameter_type first_parameter_type) { basic_function_node bfn = new basic_function_node(bas_ft, ret_type,true,name); basic_parameter to = new basic_parameter(compiler_string_consts.left_param_name, ctn, first_parameter_type, bfn); basic_parameter from = new basic_parameter(compiler_string_consts.right_param_name, ctn, SemanticTree.parameter_type.value, bfn); bfn.parameters.AddElement(to); bfn.parameters.AddElement(from); ctn.add_name(name, new SymbolInfo(bfn)); add_stand_type(bas_ft, bfn); return bfn; }
/*public static void RestoreStandartNames() { _bool_type.SetName(compiler_string_consts.bool_type_name); _byte_type.SetName(compiler_string_consts.byte_type_name); _sbyte_type.SetName(compiler_string_consts.sbyte_type_name); _short_type.SetName(compiler_string_consts.short_type_name); _ushort_type.SetName(compiler_string_consts.ushort_type_name); _integer_type.SetName(compiler_string_consts.integer_type_name); ; _uint_type.SetName(compiler_string_consts.uint_type_name); _int64_type.SetName(compiler_string_consts.long_type_name); _uint64_type.SetName(compiler_string_consts.ulong_type_name); _double_type.SetName(compiler_string_consts.real_type_name); _float_type.SetName(compiler_string_consts.float_type_name); _char_type.SetName(compiler_string_consts.char_type_name); _string_type.SetName(compiler_string_consts.string_type_name); _object_type.SetName(compiler_string_consts.object_type_name); _exception_base_type.SetName(compiler_string_consts.base_exception_class_name); _array_base_type.SetName(compiler_string_consts.base_array_type_name); _delegate_base_type.SetName(compiler_string_consts.base_delegate_type_name); _enum_base_type.SetName(compiler_string_consts.base_enum_class_name); _pointer_type.SetName(compiler_string_consts.pointer_type_name); _void_type.SetName(compiler_string_consts.void_class_name); }*/ private static void make_methods() { _empty_method = new basic_function_node(SemanticTree.basic_function_type.none, null, true); basic_parameter bp = new basic_parameter(compiler_string_consts.unary_param_name, null, SemanticTree.parameter_type.value, _empty_method); _empty_method.parameters.AddElement(bp); _empty_method.compile_time_executor = delegated_empty_method; //(ssyy) Убрать подмену параметров?! Type arr_type = typeof(System.Array); System.Reflection.MethodInfo resize_func_mi = arr_type.GetMethod("Resize"); _resize_func = compiled_function_node.get_compiled_method(resize_func_mi); _resize_func.parameters.clear(); common_parameter par0 = new common_parameter("Array", _object_type, SemanticTree.parameter_type.value, null, concrete_parameter_type.cpt_none, null, null); common_parameter par1 = new common_parameter("Length", _integer_type, SemanticTree.parameter_type.value, null, concrete_parameter_type.cpt_none, null, null); _resize_func.parameters.AddElement(par0); _resize_func.parameters.AddElement(par1); resize_func.compile_time_executor = set_length_compile_time_executor; }
public SymbolInfo(basic_parameter value) { //_name_information_type=name_information_type.nit_basic_parameter; _sym_info=value; _access_level=access_level.al_public; _symbol_kind=symbol_kind.sk_none; }