public compiled_generic_instance_type_node(compiled_type_node generic_definition, List<type_node> param_types, type_node base_type, string name, SemanticTree.type_access_level type_access_level, common_namespace_node comprehensive_namespace, location loc) : base(generic_definition, param_types, base_type, name, type_access_level, comprehensive_namespace, loc) { }
//\ssyy private void VisitCompiledTypeDefinition(compiled_type_node type) { int offset = 0; if (is_interface == true) offset = SavePositionAndConstPool(type); else offset = SavePositionAndImplementationPool(type); bw.Write((byte)type.semantic_node_type); bw.Write(is_interface); if (is_interface == true) bw.Write(GetNameIndex(type)); else bw.Write(type.name); WriteTypeReference(type); WriteDebugInfo(type.Location); }
public void reset() { _cmn = null; _ctn = null; _func_stack.clear(); var_defs.Clear(); _main_procedure = null; _last_created_function = null; _cycles_stack.clear(); _num_of_for_cycles = 0; _fal = SemanticTree.field_access_level.fal_private; rec_num = 1; var_defs_stack.Clear(); type_stack.Clear(); clear_special_local_vars(); _scope_stack.Clear(); TypedFiles.Clear(); ShortStringTypes.Clear(); TypedSets.Clear(); _compiled_tn = null; _explicit_interface_type = null; _ctt = null; allow_inherited_ctor_call = false; _types_predefined.Clear(); _block_stack.Clear(); member_decls.Clear(); possible_incorrect_instances.Clear(); skip_check_where_sections = false; LambdaHelper.Reset(); //lroman// SavedContext = null; SavedContextStack.Clear(); compiled_tc_cache.Clear(); extension_method = false; _last_created_function = null; in_parameters_block = false; is_order_independed_method_description = false; }
private static function_node make_compiled_operator(compiled_type_node declaring_type, string method_name,string new_name,compiled_type_node left_type,compiled_type_node right_type) { compiled_function_node fn=NetHelper.NetHelper.get_compiled_method(declaring_type, method_name, left_type, right_type); declaring_type.add_name(new_name,new SymbolInfo(fn)); return fn; }
private static function_node make_unary_compiled_operator(compiled_type_node operand_type, string method_name, string new_name) { return make_compiled_operator(operand_type, method_name, new_name, operand_type); }
public void reset() { _system_unit = null; SystemLibrary.SystemLibrary.system_unit = null; //SystemLibrary.SystemLibrary.Reset(); SystemUnitAssigned = false; _compiled_unit = null; _referenced_units = null; current_document = null; using_list.clear(); //_referenced_units.clear(); ret.reset(); motivation_keeper.reset(); context.reset(); convertion_data_and_alghoritms.reset(); //compiled_type_node.compiled_types.Clear(); internal_reset(); release_system_module(); WaitedRefTypes.Clear(); set_intls.Clear(); NetHelper.NetHelper.reset(); if (ErrorsList != null) ErrorsList.Clear(); from_pabc_dll = false; in_interface_part = false; compiled_type_node[] ctns = new compiled_type_node[compiled_type_node.compiled_types.Values.Count]; compiled_type_node.compiled_types.Values.CopyTo(ctns, 0); null_type_node.reset(); foreach (compiled_type_node ctn in ctns) { ctn.reinit_scope(); ctn.clear_generated_names(); ctn.clear_generated_intersections(); } }
/*public static void Reset() { (string_type as compiled_type_node).reinit_scope(); }*/ //TODO: Замечание к TODO перед этим классом. Просто сохранить ссылки на все объекты, которые мы здесь получаем. private static void initialize_types() { //TODO: (??? подумать над именами!!) /* bit Shortint signed 8 Byte unsigned 8 Smallint signed 16 Word unsigned 16 Integer signed 32 Cardinal unsigned 32 Longint signed 64 ULongint unsigned 64 Decimal signed 128 */ _byte_type = compiled_type_node.get_type_node(typeof(byte), symtab); _byte_type.SetName(compiler_string_consts.byte_type_name); _sbyte_type = compiled_type_node.get_type_node(typeof(sbyte), symtab); _sbyte_type.SetName(compiler_string_consts.sbyte_type_name); _short_type = compiled_type_node.get_type_node(typeof(short), symtab); _short_type.SetName(compiler_string_consts.short_type_name); _ushort_type = compiled_type_node.get_type_node(typeof(ushort), symtab); _ushort_type.SetName(compiler_string_consts.ushort_type_name); _integer_type = compiled_type_node.get_type_node(typeof(int), symtab); _integer_type.SetName(compiler_string_consts.integer_type_name); _uint_type = compiled_type_node.get_type_node(typeof(uint), symtab); _uint_type.SetName(compiler_string_consts.uint_type_name); _int64_type = compiled_type_node.get_type_node(typeof(long), symtab); _int64_type.SetName(compiler_string_consts.long_type_name); _uint64_type = compiled_type_node.get_type_node(typeof(ulong), symtab); _uint64_type.SetName(compiler_string_consts.ulong_type_name); _icloneable_interface = compiled_type_node.get_type_node(typeof(ICloneable), symtab); _ilist_interface = compiled_type_node.get_type_node(typeof(IList), symtab); _icollection_interface = compiled_type_node.get_type_node(typeof(ICollection)); _ienumerable_interface = compiled_type_node.get_type_node(typeof(IEnumerable)); _ilist1_interface = compiled_type_node.get_type_node(typeof(IList<>)); _icollection1_interface = compiled_type_node.get_type_node(typeof(ICollection<>)); _ienumerable1_interface = compiled_type_node.get_type_node(typeof(IEnumerable<>)); _assert_method = compiled_function_node.get_compiled_method(typeof(System.Diagnostics.Debug).GetMethod("Assert",new Type[1]{typeof(bool)})); _decimal_type = compiled_type_node.get_type_node(typeof(decimal), symtab); //_decimal_type.SetName(compiler_string_consts.decimal_type_name); make_assign_operator(_decimal_type, SemanticTree.basic_function_type.objassign); _bool_type = compiled_type_node.get_type_node(typeof(bool), symtab); _bool_type.SetName(compiler_string_consts.bool_type_name); _double_type = compiled_type_node.get_type_node(typeof(double), symtab); _double_type.SetName(compiler_string_consts.real_type_name); _float_type = compiled_type_node.get_type_node(typeof(float), symtab); _float_type.SetName(compiler_string_consts.float_type_name); _char_type = compiled_type_node.get_type_node(typeof(char), symtab); _char_type.SetName(compiler_string_consts.char_type_name); _string_type = compiled_type_node.get_type_node(typeof(string), symtab); _string_type.SetName(compiler_string_consts.string_type_name); _pointer_type = compiled_type_node.get_type_node(NetHelper.NetHelper.void_ptr_type, symtab); _pointer_type.SetName(compiler_string_consts.pointer_type_name); _object_type = compiled_type_node.get_type_node(typeof(object), symtab); _object_type.SetName(compiler_string_consts.object_type_name); _enum_base_type = compiled_type_node.get_type_node(typeof(System.Enum), symtab); _delegate_base_type = compiled_type_node.get_type_node(typeof(System.MulticastDelegate), symtab); _delegate_base_type.SetName(compiler_string_consts.base_delegate_type_name); _system_delegate_type = compiled_type_node.get_type_node(typeof(System.Delegate), symtab); _array_base_type = compiled_type_node.get_type_node(typeof(System.Array), symtab); _array_base_type.SetName(compiler_string_consts.base_array_type_name); _void_type = compiled_type_node.get_type_node(typeof(void), symtab); _value_type = compiled_type_node.get_type_node(typeof(ValueType),symtab); Type delegate_type = typeof(System.Delegate); Type[] arr_params=new Type[2]; arr_params[0]=delegate_type; arr_params[1]=delegate_type; _delegate_combine_method = compiled_function_node.get_compiled_method(delegate_type.GetMethod(compiler_string_consts.combine_method_name, arr_params)); _delegate_remove_method = compiled_function_node.get_compiled_method(delegate_type.GetMethod(compiler_string_consts.remove_method_name, arr_params)); _object_equals_method = compiled_function_node.get_compiled_method(typeof(object).GetMethod(compiler_string_consts.object_equals_name, new Type[2] { typeof(object), typeof(object) })); //Это для прикола. Убрать! //make_common_binary_operation(compiler_string_consts.plus_name, _integer_type, _integer_type, _byte_type, SemanticTree.basic_function_type.badd, _byte_type); //Это нормально? (чтобы работало i:=+15;) /* make_unary_operator(compiler_string_consts.plus_name, _byte_type, SemanticTree.basic_function_type.none); make_unary_operator(compiler_string_consts.plus_name, _integer_type, SemanticTree.basic_function_type.none); make_unary_operator(compiler_string_consts.plus_name, _long_type, SemanticTree.basic_function_type.none); make_unary_operator(compiler_string_consts.plus_name, _real_type, SemanticTree.basic_function_type.none); */ //integer type //Преобразования типов. _int_to_byte = make_type_conversion(_integer_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.itob); _int_to_sbyte = make_type_conversion(_integer_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.itosb); _int_to_short = make_type_conversion(_integer_type, _short_type, type_compare.greater_type, SemanticTree.basic_function_type.itos); _int_to_ushort = make_type_conversion(_integer_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.itous); _int_to_uint = make_type_conversion(_integer_type, _uint_type, type_compare.greater_type, SemanticTree.basic_function_type.itoui); _int_to_long = make_type_conversion(_integer_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.itol); _int_to_ulong = make_type_conversion(_integer_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.itoul); _int_to_char = make_type_conversion(_integer_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.itochar, false); _int_to_double=make_type_conversion(_integer_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.itod); //make_type_conversion(_integer_type, _long_type, type_compare.less_type, SemanticTree.basic_function_type.itol); _int_to_float = make_type_conversion(_integer_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.itof); //Присваивание для integer. _int_assign=make_assign_operator(_integer_type, SemanticTree.basic_function_type.iassign); //Унарные операции. _int_unmin=make_unary_operator(compiler_string_consts.minus_name, _integer_type, SemanticTree.basic_function_type.iunmin); _int_not = make_unary_operator(compiler_string_consts.not_name, _integer_type, SemanticTree.basic_function_type.inot); make_unary_empty_operator(compiler_string_consts.plus_name, _integer_type, _integer_type); //Арифметические операции. _int_add = make_binary_operator(compiler_string_consts.plus_name, _integer_type, SemanticTree.basic_function_type.iadd); _int_sub = make_binary_operator(compiler_string_consts.minus_name, _integer_type, SemanticTree.basic_function_type.isub); _int_mul=make_binary_operator(compiler_string_consts.mul_name, _integer_type, SemanticTree.basic_function_type.imul); _int_idiv=make_binary_operator(compiler_string_consts.idiv_name, _integer_type, SemanticTree.basic_function_type.idiv); _int_mod=make_binary_operator(compiler_string_consts.mod_name, _integer_type, SemanticTree.basic_function_type.imod); //Операция / для integer. _int_div = make_common_binary_operation(compiler_string_consts.div_name, _integer_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //_int_div = make_common_binary_operation(compiler_string_consts.div_name, _integer_type, _integer_type, _integer_type, // SemanticTree.basic_function_type.ddiv, _real_type); //Опрерации сравнения. _int_gr=make_binary_operator(compiler_string_consts.gr_name, _integer_type, SemanticTree.basic_function_type.igr, _bool_type); _int_greq=make_binary_operator(compiler_string_consts.greq_name, _integer_type, SemanticTree.basic_function_type.igreq, _bool_type); _int_sm=make_binary_operator(compiler_string_consts.sm_name, _integer_type, SemanticTree.basic_function_type.ism, _bool_type); _int_smeq=make_binary_operator(compiler_string_consts.smeq_name, _integer_type, SemanticTree.basic_function_type.ismeq, _bool_type); _int_eq=make_binary_operator(compiler_string_consts.eq_name, _integer_type, SemanticTree.basic_function_type.ieq, _bool_type); _int_noteq=make_binary_operator(compiler_string_consts.noteq_name, _integer_type, SemanticTree.basic_function_type.inoteq, _bool_type); //Логические опреции. _int_and=make_binary_operator(compiler_string_consts.and_name, _integer_type, SemanticTree.basic_function_type.iand); _int_or=make_binary_operator(compiler_string_consts.or_name, _integer_type, SemanticTree.basic_function_type.ior); _int_xor=make_binary_operator(compiler_string_consts.xor_name, _integer_type, SemanticTree.basic_function_type.ixor); _int_shl=make_binary_operator(compiler_string_consts.shl_name, _integer_type, SemanticTree.basic_function_type.ishl); _int_shr=make_binary_operator(compiler_string_consts.shr_name, _integer_type, SemanticTree.basic_function_type.ishr); //byte type. //Assign. _byte_assign = make_assign_operator(_byte_type, SemanticTree.basic_function_type.bassign); //Преобразования типов. _byte_to_sbyte = make_type_conversion(_byte_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.btosb); _byte_to_short = make_type_conversion(_byte_type, _short_type, type_compare.less_type, SemanticTree.basic_function_type.btos); _byte_to_ushort = make_type_conversion(_byte_type, _ushort_type, type_compare.less_type, SemanticTree.basic_function_type.btous); _byte_to_uint = make_type_conversion(_byte_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.btoui); _byte_to_long = make_type_conversion(_byte_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.btol); _byte_to_ulong = make_type_conversion(_byte_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.btoul); _byte_to_int = make_type_conversion(_byte_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.btoi); _byte_to_char = make_type_conversion(_byte_type, _char_type, type_compare.less_type, SemanticTree.basic_function_type.btochar,false); _byte_to_float = make_type_conversion(_byte_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.btof); _byte_to_double = make_type_conversion(_byte_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.btod); //Унарные операции. _byte_unmin = make_unary_operator(compiler_string_consts.minus_name, _byte_type, SemanticTree.basic_function_type.bunmin, _integer_type); _byte_not = make_unary_operator(compiler_string_consts.not_name, _byte_type, SemanticTree.basic_function_type.bnot); make_unary_empty_operator(compiler_string_consts.plus_name, _byte_type, _byte_type); //Опрерации сравнения. /* _byte_gr = make_binary_operator(compiler_string_consts.gr_name, _byte_type, SemanticTree.basic_function_type.bgr, _bool_type); _byte_greq = make_binary_operator(compiler_string_consts.greq_name, _byte_type, SemanticTree.basic_function_type.bgreq, _bool_type); _byte_sm = make_binary_operator(compiler_string_consts.sm_name, _byte_type, SemanticTree.basic_function_type.bsm, _bool_type); _byte_smeq = make_binary_operator(compiler_string_consts.smeq_name, _byte_type, SemanticTree.basic_function_type.bsmeq, _bool_type); _byte_eq = make_binary_operator(compiler_string_consts.eq_name, _byte_type, SemanticTree.basic_function_type.beq, _bool_type); _byte_noteq = make_binary_operator(compiler_string_consts.noteq_name, _byte_type, SemanticTree.basic_function_type.bnoteq, _bool_type); */ add_function_to_type(compiler_string_consts.not_name, _byte_type, _int_unmin); add_function_to_type(compiler_string_consts.gr_name, _byte_type, _int_gr); add_function_to_type(compiler_string_consts.greq_name, _byte_type, _int_greq); add_function_to_type(compiler_string_consts.sm_name, _byte_type, _int_sm); add_function_to_type(compiler_string_consts.smeq_name, _byte_type, _int_smeq); add_function_to_type(compiler_string_consts.eq_name, _byte_type, _int_eq); add_function_to_type(compiler_string_consts.noteq_name, _byte_type, _int_noteq); add_function_to_type(compiler_string_consts.plus_name, _byte_type, _int_add); add_function_to_type(compiler_string_consts.minus_name, _byte_type, _int_sub); add_function_to_type(compiler_string_consts.mul_name, _byte_type, _int_mul); add_function_to_type(compiler_string_consts.div_name, _byte_type, _int_div); add_function_to_type(compiler_string_consts.idiv_name, _byte_type, _int_idiv); add_function_to_type(compiler_string_consts.mod_name, _byte_type, _int_mod); /*add_funtion_to_type(compiler_string_consts.and_name, _byte_type, _int_and); add_funtion_to_type(compiler_string_consts.or_name, _byte_type, _int_or); add_funtion_to_type(compiler_string_consts.xor_name, _byte_type, _int_xor);*/ //Арифметические операции. //_byte_add = make_common_binary_operation(compiler_string_consts.plus_name, _byte_type, _byte_type,_byte_type, SemanticTree.basic_function_type.badd, _integer_type); /* _byte_sub = make_common_binary_operation(compiler_string_consts.minus_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bsub, _integer_type); _byte_mul = make_common_binary_operation(compiler_string_consts.mul_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bmul, _integer_type); _byte_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bdiv, _integer_type); _byte_mod = make_common_binary_operation(compiler_string_consts.mod_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bmod, _integer_type); */ //Операция / для byte. _byte_div = make_common_binary_operation(compiler_string_consts.div_name, _byte_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _byte_and = make_common_binary_operation(compiler_string_consts.and_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.band, _byte_type); _byte_or = make_common_binary_operation(compiler_string_consts.or_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bor, _byte_type); _byte_xor = make_common_binary_operation(compiler_string_consts.xor_name, _byte_type, _byte_type, _byte_type, SemanticTree.basic_function_type.bxor, _byte_type); add_function_to_type(compiler_string_consts.shl_name, _byte_type, _int_shl); add_function_to_type(compiler_string_consts.shr_name, _byte_type, _int_shr); //_byte_shl = make_binary_operator(compiler_string_consts.shl_name, _byte_type, SemanticTree.basic_function_type.bshl); //_byte_shr = make_binary_operator(compiler_string_consts.shr_name, _byte_type, SemanticTree.basic_function_type.bshr); //sbyte type. //Assign. _sbyte_assign = make_assign_operator(_sbyte_type, SemanticTree.basic_function_type.sbassign); //Преобразования sbyteов. _sbyte_to_byte = make_type_conversion(_sbyte_type, _byte_type, type_compare.less_type, SemanticTree.basic_function_type.sbtob); _sbyte_to_short = make_type_conversion(_sbyte_type, _short_type, type_compare.less_type, SemanticTree.basic_function_type.sbtos); _sbyte_to_ushort = make_type_conversion(_sbyte_type, _ushort_type, type_compare.less_type, SemanticTree.basic_function_type.sbtous); _sbyte_to_uint = make_type_conversion(_sbyte_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.sbtoui); _sbyte_to_long = make_type_conversion(_sbyte_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.sbtol); _sbyte_to_ulong = make_type_conversion(_sbyte_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.sbtoul); _sbyte_to_int = make_type_conversion(_sbyte_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.sbtoi); _sbyte_to_char = make_type_conversion(_sbyte_type, _char_type, type_compare.less_type, SemanticTree.basic_function_type.sbtochar,false); _sbyte_to_float = make_type_conversion(_sbyte_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.sbtof); _sbyte_to_double = make_type_conversion(_sbyte_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.sbtod); //Унарные операции. _sbyte_unmin = make_unary_operator(compiler_string_consts.minus_name, _sbyte_type, SemanticTree.basic_function_type.sbunmin, _integer_type); _sbyte_not = make_unary_operator(compiler_string_consts.not_name, _sbyte_type, SemanticTree.basic_function_type.sbnot); make_unary_empty_operator(compiler_string_consts.plus_name, _sbyte_type, _sbyte_type); add_function_to_type(compiler_string_consts.not_name, _sbyte_type, _int_unmin); add_function_to_type(compiler_string_consts.gr_name, _sbyte_type, _int_gr); add_function_to_type(compiler_string_consts.greq_name, _sbyte_type, _int_greq); add_function_to_type(compiler_string_consts.sm_name, _sbyte_type, _int_sm); add_function_to_type(compiler_string_consts.smeq_name, _sbyte_type, _int_smeq); add_function_to_type(compiler_string_consts.eq_name, _sbyte_type, _int_eq); add_function_to_type(compiler_string_consts.noteq_name, _sbyte_type, _int_noteq); add_function_to_type(compiler_string_consts.plus_name, _sbyte_type, _int_add); add_function_to_type(compiler_string_consts.minus_name, _sbyte_type, _int_sub); add_function_to_type(compiler_string_consts.mul_name, _sbyte_type, _int_mul); add_function_to_type(compiler_string_consts.div_name, _sbyte_type, _int_div); add_function_to_type(compiler_string_consts.idiv_name, _sbyte_type, _int_idiv); add_function_to_type(compiler_string_consts.mod_name, _sbyte_type, _int_mod); /*add_funtion_to_type(compiler_string_consts.and_name, _sbyte_type, _int_and); add_funtion_to_type(compiler_string_consts.or_name, _sbyte_type, _int_or); add_funtion_to_type(compiler_string_consts.xor_name, _sbyte_type, _int_xor);*/ //Опрерации сравнения. /* _sbyte_gr = make_binary_operator(compiler_string_consts.gr_name, _sbyte_type, SemanticTree.basic_function_type.sbgr, _bool_type); _sbyte_greq = make_binary_operator(compiler_string_consts.greq_name, _sbyte_type, SemanticTree.basic_function_type.sbgreq, _bool_type); _sbyte_sm = make_binary_operator(compiler_string_consts.sm_name, _sbyte_type, SemanticTree.basic_function_type.sbsm, _bool_type); _sbyte_smeq = make_binary_operator(compiler_string_consts.smeq_name, _sbyte_type, SemanticTree.basic_function_type.sbsmeq, _bool_type); _sbyte_eq = make_binary_operator(compiler_string_consts.eq_name, _sbyte_type, SemanticTree.basic_function_type.sbeq, _bool_type); _sbyte_noteq = make_binary_operator(compiler_string_consts.noteq_name, _sbyte_type, SemanticTree.basic_function_type.sbnoteq, _bool_type); */ //Арифметические операции. /* _sbyte_add = make_common_binary_operation(compiler_string_consts.plus_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbadd, _integer_type); _sbyte_sub = make_common_binary_operation(compiler_string_consts.minus_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbsub, _integer_type); _sbyte_mul = make_common_binary_operation(compiler_string_consts.mul_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbmul, _integer_type); _sbyte_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbdiv, _integer_type); _sbyte_mod = make_common_binary_operation(compiler_string_consts.mod_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbmod, _integer_type); */ //Операция / для byte. _sbyte_div = make_common_binary_operation(compiler_string_consts.div_name, _sbyte_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _sbyte_and = make_common_binary_operation(compiler_string_consts.and_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sband, _sbyte_type); _sbyte_or = make_common_binary_operation(compiler_string_consts.or_name, _sbyte_type, _sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbor, _sbyte_type); _sbyte_xor = make_common_binary_operation(compiler_string_consts.xor_name, _sbyte_type,_sbyte_type, _sbyte_type, SemanticTree.basic_function_type.sbxor, _sbyte_type); add_function_to_type(compiler_string_consts.shl_name, _sbyte_type, _int_shl); add_function_to_type(compiler_string_consts.shr_name, _sbyte_type, _int_shr); //short type. //Assign. _short_assign = make_assign_operator(_short_type, SemanticTree.basic_function_type.sassign); //Преобразования shortов. _short_to_byte = make_type_conversion(_short_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.stob); _short_to_sbyte = make_type_conversion(_short_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.stosb); _short_to_ushort = make_type_conversion(_short_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.stous); _short_to_uint = make_type_conversion(_short_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.stoui); _short_to_long = make_type_conversion(_short_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.stol); _short_to_ulong = make_type_conversion(_short_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.stoul); _short_to_int = make_type_conversion(_short_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.stoi); _short_to_char = make_type_conversion(_short_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.stochar,false); _short_to_float = make_type_conversion(_short_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.stof); _short_to_double = make_type_conversion(_short_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.stod); //Унарные операции. _short_unmin = make_unary_operator(compiler_string_consts.minus_name, _short_type, SemanticTree.basic_function_type.sunmin,_integer_type); _short_not = make_unary_operator(compiler_string_consts.not_name, _short_type, SemanticTree.basic_function_type.snot); make_unary_empty_operator(compiler_string_consts.plus_name, _short_type, _short_type); add_function_to_type(compiler_string_consts.not_name, _short_type, _int_unmin); add_function_to_type(compiler_string_consts.gr_name, _short_type, _int_gr); add_function_to_type(compiler_string_consts.greq_name, _short_type, _int_greq); add_function_to_type(compiler_string_consts.sm_name, _short_type, _int_sm); add_function_to_type(compiler_string_consts.smeq_name, _short_type, _int_smeq); add_function_to_type(compiler_string_consts.eq_name, _short_type, _int_eq); add_function_to_type(compiler_string_consts.noteq_name, _short_type, _int_noteq); add_function_to_type(compiler_string_consts.plus_name, _short_type, _int_add); add_function_to_type(compiler_string_consts.minus_name, _short_type, _int_sub); add_function_to_type(compiler_string_consts.mul_name, _short_type, _int_mul); add_function_to_type(compiler_string_consts.div_name, _short_type, _int_div); add_function_to_type(compiler_string_consts.idiv_name, _short_type, _int_idiv); add_function_to_type(compiler_string_consts.mod_name, _short_type, _int_mod); /*add_funtion_to_type(compiler_string_consts.and_name, _short_type, _int_and); add_funtion_to_type(compiler_string_consts.or_name, _short_type, _int_or); add_funtion_to_type(compiler_string_consts.xor_name, _short_type, _int_xor);*/ //Опрерации сравнения. /* _short_gr = make_binary_operator(compiler_string_consts.gr_name, _short_type, SemanticTree.basic_function_type.sgr, _bool_type); _short_greq = make_binary_operator(compiler_string_consts.greq_name, _short_type, SemanticTree.basic_function_type.sgreq, _bool_type); _short_sm = make_binary_operator(compiler_string_consts.sm_name, _short_type, SemanticTree.basic_function_type.ssm, _bool_type); _short_smeq = make_binary_operator(compiler_string_consts.smeq_name, _short_type, SemanticTree.basic_function_type.ssmeq, _bool_type); _short_eq = make_binary_operator(compiler_string_consts.eq_name, _short_type, SemanticTree.basic_function_type.seq, _bool_type); _short_noteq = make_binary_operator(compiler_string_consts.noteq_name, _short_type, SemanticTree.basic_function_type.snoteq, _bool_type); */ //Арифметические операции. /* _short_add = make_common_binary_operation(compiler_string_consts.plus_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sadd, _integer_type); _short_sub = make_common_binary_operation(compiler_string_consts.minus_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.ssub, _integer_type); _short_mul = make_common_binary_operation(compiler_string_consts.mul_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.smul, _integer_type); _short_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sdiv, _integer_type); _short_mod = make_common_binary_operation(compiler_string_consts.mod_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.smod, _integer_type); */ //Операция / для byte. _short_div = make_common_binary_operation(compiler_string_consts.div_name, _short_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _short_and = make_common_binary_operation(compiler_string_consts.and_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sand, _short_type); _short_or = make_common_binary_operation(compiler_string_consts.or_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sor, _short_type); _short_xor = make_common_binary_operation(compiler_string_consts.xor_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sxor, _short_type); add_function_to_type(compiler_string_consts.shl_name, _short_type, _int_shl); add_function_to_type(compiler_string_consts.shr_name, _short_type, _int_shr); //ushort type. //Assign. _ushort_assign = make_assign_operator(_ushort_type, SemanticTree.basic_function_type.usassign); //Преобразования ushortов. _ushort_to_byte = make_type_conversion(_ushort_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.ustob); _ushort_to_sbyte = make_type_conversion(_ushort_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.ustosb); _ushort_to_short = make_type_conversion(_ushort_type, _short_type, type_compare.less_type, SemanticTree.basic_function_type.ustos); _ushort_to_uint = make_type_conversion(_ushort_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.ustoui); _ushort_to_long = make_type_conversion(_ushort_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.ustol); _ushort_to_ulong = make_type_conversion(_ushort_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.ustoul); _ushort_to_int = make_type_conversion(_ushort_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.ustoi); _ushort_to_char = make_type_conversion(_ushort_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.ustochar,false); _ushort_to_float = make_type_conversion(_ushort_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.ustof); _ushort_to_double = make_type_conversion(_ushort_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.ustod); //Унарные операции. _ushort_unmin = make_unary_operator(compiler_string_consts.minus_name, _ushort_type, SemanticTree.basic_function_type.usunmin, _integer_type); _ushort_not = make_unary_operator(compiler_string_consts.not_name, _ushort_type, SemanticTree.basic_function_type.usnot); make_unary_empty_operator(compiler_string_consts.plus_name, _ushort_type, _ushort_type); add_function_to_type(compiler_string_consts.not_name, _ushort_type, _int_unmin); add_function_to_type(compiler_string_consts.gr_name, _ushort_type, _int_gr); add_function_to_type(compiler_string_consts.greq_name, _ushort_type, _int_greq); add_function_to_type(compiler_string_consts.sm_name, _ushort_type, _int_sm); add_function_to_type(compiler_string_consts.smeq_name, _ushort_type, _int_smeq); add_function_to_type(compiler_string_consts.eq_name, _ushort_type, _int_eq); add_function_to_type(compiler_string_consts.noteq_name, _ushort_type, _int_noteq); add_function_to_type(compiler_string_consts.plus_name, _ushort_type, _int_add); add_function_to_type(compiler_string_consts.minus_name, _ushort_type, _int_sub); add_function_to_type(compiler_string_consts.mul_name, _ushort_type, _int_mul); add_function_to_type(compiler_string_consts.div_name, _ushort_type, _int_div); add_function_to_type(compiler_string_consts.idiv_name, _ushort_type, _int_idiv); add_function_to_type(compiler_string_consts.mod_name, _ushort_type, _int_mod); /*add_funtion_to_type(compiler_string_consts.and_name, _ushort_type, _int_and); add_funtion_to_type(compiler_string_consts.or_name, _ushort_type, _int_or); add_funtion_to_type(compiler_string_consts.xor_name, _ushort_type, _int_xor);*/ //Опрерации сравнения. /* _ushort_gr = make_binary_operator(compiler_string_consts.gr_name, _ushort_type, SemanticTree.basic_function_type.usgr, _bool_type); _ushort_greq = make_binary_operator(compiler_string_consts.greq_name, _ushort_type, SemanticTree.basic_function_type.usgreq, _bool_type); _ushort_sm = make_binary_operator(compiler_string_consts.sm_name, _ushort_type, SemanticTree.basic_function_type.ussm, _bool_type); _ushort_smeq = make_binary_operator(compiler_string_consts.smeq_name, _ushort_type, SemanticTree.basic_function_type.ussmeq, _bool_type); _ushort_eq = make_binary_operator(compiler_string_consts.eq_name, _ushort_type, SemanticTree.basic_function_type.useq, _bool_type); _ushort_noteq = make_binary_operator(compiler_string_consts.noteq_name, _ushort_type, SemanticTree.basic_function_type.usnoteq, _bool_type); */ //Арифметические операции. /* _ushort_add = make_common_binary_operation(compiler_string_consts.plus_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usadd, _integer_type); _ushort_sub = make_common_binary_operation(compiler_string_consts.minus_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.ussub, _integer_type); _ushort_mul = make_common_binary_operation(compiler_string_consts.mul_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usmul, _integer_type); _ushort_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usdiv, _integer_type); _ushort_mod = make_common_binary_operation(compiler_string_consts.mod_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usmod, _integer_type); */ //Операция / для byte. _ushort_div = make_common_binary_operation(compiler_string_consts.div_name, _ushort_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _ushort_and = make_common_binary_operation(compiler_string_consts.and_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usand, _ushort_type); _ushort_or = make_common_binary_operation(compiler_string_consts.or_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usor, _ushort_type); _ushort_xor = make_common_binary_operation(compiler_string_consts.xor_name, _ushort_type, _ushort_type, _ushort_type, SemanticTree.basic_function_type.usxor, _ushort_type); add_function_to_type(compiler_string_consts.shl_name, _ushort_type, _int_shl); add_function_to_type(compiler_string_consts.shr_name, _ushort_type, _int_shr); /* //short type. //Assign. _short_assign = make_assign_operator(_short_type, SemanticTree.basic_function_type.sassign); //Преобразования shortов. _short_to_byte = make_type_conversion(_short_type, _byte_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stob, false); _short_to_sbyte = make_type_conversion(_short_type, _sbyte_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stosb, false); _short_to_ushort = make_type_conversion(_short_type, _ushort_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stous); _short_to_uint = make_type_conversion(_short_type, _uint_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stoui,false); _short_to_long = make_type_conversion(_short_type, _long_type, type_compare.less_type, SemanticTree.basic_function_type.stol); _short_to_ulong = make_type_conversion(_short_type, _ulong_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stoul); _short_to_int = make_type_conversion(_short_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.stoi); _short_to_char = make_type_conversion(_short_type, _char_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.stochar, false); _short_to_float = make_type_conversion(_short_type, _real_type, type_compare.less_type, SemanticTree.basic_function_type.stof); _short_to_double = make_type_conversion(_short_type, _long_type, type_compare.less_type, SemanticTree.basic_function_type.stod); //Унарные операции. _short_unmin = make_unary_operator(compiler_string_consts.minus_name, _short_type, SemanticTree.basic_function_type.sunmin); _short_not = make_unary_operator(compiler_string_consts.not_name, _short_type, SemanticTree.basic_function_type.snot); make_unary_empty_operator(compiler_string_consts.plus_name, _short_type, _short_type); //Опрерации сравнения. _short_gr = make_binary_operator(compiler_string_consts.gr_name, _short_type, SemanticTree.basic_function_type.sgr, _bool_type); _short_greq = make_binary_operator(compiler_string_consts.greq_name, _short_type, SemanticTree.basic_function_type.sgreq, _bool_type); _short_sm = make_binary_operator(compiler_string_consts.sm_name, _short_type, SemanticTree.basic_function_type.ssm, _bool_type); _short_smeq = make_binary_operator(compiler_string_consts.smeq_name, _short_type, SemanticTree.basic_function_type.ssmeq, _bool_type); _short_eq = make_binary_operator(compiler_string_consts.eq_name, _short_type, SemanticTree.basic_function_type.seq, _bool_type); _short_noteq = make_binary_operator(compiler_string_consts.noteq_name, _short_type, SemanticTree.basic_function_type.snoteq, _bool_type); //Арифметические операции. _short_add = make_common_binary_operation(compiler_string_consts.plus_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sadd, _integer_type); _short_sub = make_common_binary_operation(compiler_string_consts.minus_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.ssub, _integer_type); _short_mul = make_common_binary_operation(compiler_string_consts.mul_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.smul, _integer_type); _short_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.sdiv, _integer_type); _short_mod = make_common_binary_operation(compiler_string_consts.mod_name, _short_type, _short_type, _short_type, SemanticTree.basic_function_type.smod, _integer_type); //Операция / для byte. _short_div = make_common_binary_operation(compiler_string_consts.div_name, _short_type, _real_type, _real_type, SemanticTree.basic_function_type.ddiv, _real_type); //Логические опреции. _short_and = make_common_binary_operation(compiler_string_consts.and_name, _short_type, _integer_type, _integer_type, SemanticTree.basic_function_type.sand, _integer_type); _short_or = make_common_binary_operation(compiler_string_consts.or_name, _short_type, _integer_type, _integer_type, SemanticTree.basic_function_type.sor, _integer_type); _short_xor = make_common_binary_operation(compiler_string_consts.xor_name, _short_type, _integer_type, _integer_type, SemanticTree.basic_function_type.sxor, _integer_type); add_funtion_to_type(compiler_string_consts.shl_name, _short_type, _int_shl); add_funtion_to_type(compiler_string_consts.shr_name, _short_type, _int_shr); */ //uint type. //Assign. _uint_assign = make_assign_operator(_uint_type, SemanticTree.basic_function_type.uiassign); //Преобразования uintов. _uint_to_byte = make_type_conversion(_uint_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.uitob); _uint_to_sbyte = make_type_conversion(_uint_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.uitosb); _uint_to_short = make_type_conversion(_uint_type, _short_type, type_compare.greater_type, SemanticTree.basic_function_type.uitos); _uint_to_ushort = make_type_conversion(_uint_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.uitous); _uint_to_long = make_type_conversion(_uint_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.uitol); _uint_to_ulong = make_type_conversion(_uint_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.uitoul); _uint_to_int = make_type_conversion(_uint_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.uitoi); _uint_to_char = make_type_conversion(_uint_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.uitochar,false); _uint_to_float = make_type_conversion(_uint_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.uitof); _uint_to_double = make_type_conversion(_uint_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.uitod); //Унарные операции. _uint_unmin = make_unary_operator(compiler_string_consts.minus_name, _uint_type, SemanticTree.basic_function_type.uiunmin, _int64_type); _uint_not = make_unary_operator(compiler_string_consts.not_name, _uint_type, SemanticTree.basic_function_type.uinot); make_unary_empty_operator(compiler_string_consts.plus_name, _uint_type, _uint_type); //Опрерации сравнения. _uint_gr = make_binary_operator(compiler_string_consts.gr_name, _uint_type, SemanticTree.basic_function_type.uigr, _bool_type); _uint_greq = make_binary_operator(compiler_string_consts.greq_name, _uint_type, SemanticTree.basic_function_type.uigreq, _bool_type); _uint_sm = make_binary_operator(compiler_string_consts.sm_name, _uint_type, SemanticTree.basic_function_type.uism, _bool_type); _uint_smeq = make_binary_operator(compiler_string_consts.smeq_name, _uint_type, SemanticTree.basic_function_type.uismeq, _bool_type); _uint_eq = make_binary_operator(compiler_string_consts.eq_name, _uint_type, SemanticTree.basic_function_type.uieq, _bool_type); _uint_noteq = make_binary_operator(compiler_string_consts.noteq_name, _uint_type, SemanticTree.basic_function_type.uinoteq, _bool_type); //Арифметические операции. /*_uint_add = make_common_binary_operation(compiler_string_consts.plus_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uiadd, _uint_type); _uint_sub = make_common_binary_operation(compiler_string_consts.minus_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uisub, _uint_type); _uint_mul = make_common_binary_operation(compiler_string_consts.mul_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uimul, _uint_type); _uint_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uidiv, _uint_type); _uint_mod = make_common_binary_operation(compiler_string_consts.mod_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uimod, _uint_type); //Операция / для byte. _uint_div = make_common_binary_operation(compiler_string_consts.div_name, _uint_type, _real_type, _real_type, SemanticTree.basic_function_type.ddiv, _real_type); //Логические опреции. _uint_and = make_common_binary_operation(compiler_string_consts.and_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uiand, _uint_type); _uint_or = make_common_binary_operation(compiler_string_consts.or_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uior, _uint_type); _uint_xor = make_common_binary_operation(compiler_string_consts.xor_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uixor, _uint_type); //add_funtion_to_type(compiler_string_consts.shl_name, _uint_type, _int_shl); //add_funtion_to_type(compiler_string_consts.shr_name, _uint_type, _int_shr); _uint_shl = make_common_binary_operation(compiler_string_consts.shl_name, _uint_type, _uint_type, _integer_type, SemanticTree.basic_function_type.uishl,_uint_type); _uint_shr = make_common_binary_operation(compiler_string_consts.shr_name, _uint_type, _uint_type, _integer_type, SemanticTree.basic_function_type.uishr, _uint_type);*/ _uint_add = make_common_binary_operation(compiler_string_consts.plus_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uiadd, _int64_type); _uint_sub = make_common_binary_operation(compiler_string_consts.minus_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uisub, _int64_type); _uint_mul = make_common_binary_operation(compiler_string_consts.mul_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uimul, _int64_type); _uint_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uidiv, _int64_type); _uint_mod = make_common_binary_operation(compiler_string_consts.mod_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uimod, _int64_type); //Операция / для byte. _uint_div = make_common_binary_operation(compiler_string_consts.div_name, _uint_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _uint_and = make_common_binary_operation(compiler_string_consts.and_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uiand, _uint_type); _uint_or = make_common_binary_operation(compiler_string_consts.or_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uior, _uint_type); _uint_xor = make_common_binary_operation(compiler_string_consts.xor_name, _uint_type, _uint_type, _uint_type, SemanticTree.basic_function_type.uixor, _uint_type); //add_funtion_to_type(compiler_string_consts.shl_name, _uint_type, _int_shl); //add_funtion_to_type(compiler_string_consts.shr_name, _uint_type, _int_shr); _uint_shl = make_common_binary_operation(compiler_string_consts.shl_name, _uint_type, _uint_type, _integer_type, SemanticTree.basic_function_type.uishl,_uint_type); _uint_shr = make_common_binary_operation(compiler_string_consts.shr_name, _uint_type, _uint_type, _integer_type, SemanticTree.basic_function_type.uishr, _uint_type); /*make_function_comparison(_int_add, _uint_add, function_compare.greater); make_function_comparison(_int_sub, _uint_sub, function_compare.greater); make_function_comparison(_int_mul, _uint_mul, function_compare.greater); make_function_comparison(_int_idiv, _uint_idiv, function_compare.greater); make_function_comparison(_int_mod, _uint_mod, function_compare.greater); make_function_comparison(_int_gr, _uint_gr, function_compare.greater); make_function_comparison(_int_greq, _uint_greq, function_compare.greater); make_function_comparison(_int_sm, _uint_sm, function_compare.greater); make_function_comparison(_int_smeq, _uint_smeq, function_compare.greater); make_function_comparison(_int_eq, _uint_eq, function_compare.greater); make_function_comparison(_int_noteq, _uint_noteq, function_compare.greater); make_function_comparison(_int_and, _uint_and, function_compare.greater); make_function_comparison(_int_or, _uint_or, function_compare.greater); make_function_comparison(_int_xor, _uint_xor, function_compare.greater);*/ make_function_comparison(_int_add, _uint_add, function_compare.less); make_function_comparison(_int_sub, _uint_sub, function_compare.less); make_function_comparison(_int_mul, _uint_mul, function_compare.less); make_function_comparison(_int_idiv, _uint_idiv, function_compare.less); make_function_comparison(_int_mod, _uint_mod, function_compare.less); make_function_comparison(_int_gr, _uint_gr, function_compare.less); make_function_comparison(_int_greq, _uint_greq, function_compare.less); make_function_comparison(_int_sm, _uint_sm, function_compare.less); make_function_comparison(_int_smeq, _uint_smeq, function_compare.less); make_function_comparison(_int_eq, _uint_eq, function_compare.less); make_function_comparison(_int_noteq, _uint_noteq, function_compare.less); make_function_comparison(_int_and, _uint_and, function_compare.less); make_function_comparison(_int_or, _uint_or, function_compare.less); make_function_comparison(_int_xor, _uint_xor, function_compare.less); //long type. //Assign. _long_assign = make_assign_operator(_int64_type, SemanticTree.basic_function_type.lassign); //Преобразования longов. _long_to_byte = make_type_conversion(_int64_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.ltob); _long_to_sbyte = make_type_conversion(_int64_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.ltosb); _long_to_short = make_type_conversion(_int64_type, _short_type, type_compare.greater_type, SemanticTree.basic_function_type.ltos); _long_to_ushort = make_type_conversion(_int64_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.ltous); _long_to_uint = make_type_conversion(_int64_type, _uint_type, type_compare.greater_type, SemanticTree.basic_function_type.ltoui); _long_to_ulong = make_type_conversion(_int64_type, _uint64_type, type_compare.greater_type, SemanticTree.basic_function_type.ltoul); _long_to_int = make_type_conversion(_int64_type, _integer_type, type_compare.greater_type, SemanticTree.basic_function_type.ltoi); _long_to_char = make_type_conversion(_int64_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.ltochar,false); _long_to_float = make_type_conversion(_int64_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.ltof); _long_to_double = make_type_conversion(_int64_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.ltod); //Унарные операции. _long_unmin = make_unary_operator(compiler_string_consts.minus_name, _int64_type, SemanticTree.basic_function_type.lunmin); _long_not = make_unary_operator(compiler_string_consts.not_name, _int64_type, SemanticTree.basic_function_type.lnot); make_unary_empty_operator(compiler_string_consts.plus_name, _int64_type, _int64_type); //Опрерации сравнения. _long_gr = make_binary_operator(compiler_string_consts.gr_name, _int64_type, SemanticTree.basic_function_type.lgr, _bool_type); _long_greq = make_binary_operator(compiler_string_consts.greq_name, _int64_type, SemanticTree.basic_function_type.lgreq, _bool_type); _long_sm = make_binary_operator(compiler_string_consts.sm_name, _int64_type, SemanticTree.basic_function_type.lsm, _bool_type); _long_smeq = make_binary_operator(compiler_string_consts.smeq_name, _int64_type, SemanticTree.basic_function_type.lsmeq, _bool_type); _long_eq = make_binary_operator(compiler_string_consts.eq_name, _int64_type, SemanticTree.basic_function_type.leq, _bool_type); _long_noteq = make_binary_operator(compiler_string_consts.noteq_name, _int64_type, SemanticTree.basic_function_type.lnoteq, _bool_type); //Арифметические операции. _long_add = make_common_binary_operation(compiler_string_consts.plus_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.ladd, _int64_type); _long_sub = make_common_binary_operation(compiler_string_consts.minus_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.lsub, _int64_type); _long_mul = make_common_binary_operation(compiler_string_consts.mul_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.lmul, _int64_type); _long_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.ldiv, _int64_type); _long_mod = make_common_binary_operation(compiler_string_consts.mod_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.lmod, _int64_type); //Операция / для byte. _long_div = make_common_binary_operation(compiler_string_consts.div_name, _int64_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _long_and = make_common_binary_operation(compiler_string_consts.and_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.land, _int64_type); _long_or = make_common_binary_operation(compiler_string_consts.or_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.lor, _int64_type); _long_xor = make_common_binary_operation(compiler_string_consts.xor_name, _int64_type, _int64_type, _int64_type, SemanticTree.basic_function_type.lxor, _int64_type); //add_funtion_to_type(compiler_string_consts.shl_name, _long_type, _int_shl); //add_funtion_to_type(compiler_string_consts.shr_name, _long_type, _int_shr); _long_shl = make_common_binary_operation(compiler_string_consts.shl_name, _int64_type, _int64_type, _integer_type, SemanticTree.basic_function_type.lshl, _int64_type); _long_shr = make_common_binary_operation(compiler_string_consts.shr_name, _int64_type, _int64_type, _integer_type, SemanticTree.basic_function_type.lshr, _int64_type); make_function_comparison(_long_add, _uint_add, function_compare.greater); make_function_comparison(_long_sub, _uint_sub, function_compare.greater); make_function_comparison(_long_mul, _uint_mul, function_compare.greater); make_function_comparison(_long_idiv, _uint_idiv, function_compare.greater); make_function_comparison(_long_mod, _uint_mod, function_compare.greater); make_function_comparison(_long_gr, _uint_gr, function_compare.greater); make_function_comparison(_long_greq, _uint_greq, function_compare.greater); make_function_comparison(_long_sm, _uint_sm, function_compare.greater); make_function_comparison(_long_smeq, _uint_smeq, function_compare.greater); make_function_comparison(_long_eq, _uint_eq, function_compare.greater); make_function_comparison(_long_noteq, _uint_noteq, function_compare.greater); make_function_comparison(_long_and, _uint_and, function_compare.greater); make_function_comparison(_long_or, _uint_or, function_compare.greater); make_function_comparison(_long_xor, _uint_xor, function_compare.greater); make_function_comparison(_long_add, _int_add, function_compare.greater); make_function_comparison(_long_sub, _int_sub, function_compare.greater); make_function_comparison(_long_mul, _int_mul, function_compare.greater); make_function_comparison(_long_idiv, _int_idiv, function_compare.greater); make_function_comparison(_long_mod, _int_mod, function_compare.greater); make_function_comparison(_long_gr, _int_gr, function_compare.greater); make_function_comparison(_long_greq, _int_greq, function_compare.greater); make_function_comparison(_long_sm, _int_sm, function_compare.greater); make_function_comparison(_long_smeq, _int_smeq, function_compare.greater); make_function_comparison(_long_eq, _int_eq, function_compare.greater); make_function_comparison(_long_noteq, _int_noteq, function_compare.greater); make_function_comparison(_long_and, _int_and, function_compare.greater); make_function_comparison(_long_or, _int_or, function_compare.greater); make_function_comparison(_long_xor, _int_xor, function_compare.greater); //ulong type. //Assign. _ulong_assign = make_assign_operator(_uint64_type, SemanticTree.basic_function_type.ulassign); //Преобразования ulongов. _ulong_to_byte = make_type_conversion(_uint64_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.ultob); _ulong_to_sbyte = make_type_conversion(_uint64_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.ultosb); _ulong_to_short = make_type_conversion(_uint64_type, _short_type, type_compare.greater_type, SemanticTree.basic_function_type.ultos); _ulong_to_ushort = make_type_conversion(_uint64_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.ultous); _ulong_to_uint = make_type_conversion(_uint64_type, _uint_type, type_compare.greater_type, SemanticTree.basic_function_type.ultoui); _ulong_to_long = make_type_conversion(_uint64_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.ultol); _ulong_to_int = make_type_conversion(_uint64_type, _integer_type, type_compare.greater_type, SemanticTree.basic_function_type.ultoi); _ulong_to_char = make_type_conversion(_uint64_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.ultochar,false); _ulong_to_float = make_type_conversion(_uint64_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.ultof); _ulong_to_double = make_type_conversion(_uint64_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.ultod); //Унарные операции. _ulong_unmin = make_unary_operator(compiler_string_consts.minus_name, _uint64_type, SemanticTree.basic_function_type.ulunmin, _uint64_type); _ulong_not = make_unary_operator(compiler_string_consts.not_name, _uint64_type, SemanticTree.basic_function_type.ulnot); make_unary_empty_operator(compiler_string_consts.plus_name, _uint64_type, _uint64_type); //Опрерации сравнения. _ulong_gr = make_binary_operator(compiler_string_consts.gr_name, _uint64_type, SemanticTree.basic_function_type.ulgr, _bool_type); _ulong_greq = make_binary_operator(compiler_string_consts.greq_name, _uint64_type, SemanticTree.basic_function_type.ulgreq, _bool_type); _ulong_sm = make_binary_operator(compiler_string_consts.sm_name, _uint64_type, SemanticTree.basic_function_type.ulsm, _bool_type); _ulong_smeq = make_binary_operator(compiler_string_consts.smeq_name, _uint64_type, SemanticTree.basic_function_type.ulsmeq, _bool_type); _ulong_eq = make_binary_operator(compiler_string_consts.eq_name, _uint64_type, SemanticTree.basic_function_type.uleq, _bool_type); _ulong_noteq = make_binary_operator(compiler_string_consts.noteq_name, _uint64_type, SemanticTree.basic_function_type.ulnoteq, _bool_type); //Арифметические операции. _ulong_add = make_common_binary_operation(compiler_string_consts.plus_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.uladd, _uint64_type); _ulong_sub = make_common_binary_operation(compiler_string_consts.minus_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.ulsub, _uint64_type); _ulong_mul = make_common_binary_operation(compiler_string_consts.mul_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.ulmul, _uint64_type); _ulong_idiv = make_common_binary_operation(compiler_string_consts.idiv_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.uldiv, _uint64_type); _ulong_mod = make_common_binary_operation(compiler_string_consts.mod_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.ulmod, _uint64_type); //Операция / для byte. _ulong_div = make_common_binary_operation(compiler_string_consts.div_name, _uint64_type, _double_type, _double_type, SemanticTree.basic_function_type.ddiv, _double_type); //Логические опреции. _ulong_and = make_common_binary_operation(compiler_string_consts.and_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.uland, _uint64_type); _ulong_or = make_common_binary_operation(compiler_string_consts.or_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.ulor, _uint64_type); _ulong_xor = make_common_binary_operation(compiler_string_consts.xor_name, _uint64_type, _uint64_type, _uint64_type, SemanticTree.basic_function_type.ulxor, _uint64_type); //add_funtion_to_type(compiler_string_consts.shl_name, _ulong_type, _int_shl); //add_funtion_to_type(compiler_string_consts.shr_name, _ulong_type, _int_shr); _ulong_shl = make_common_binary_operation(compiler_string_consts.shl_name, _uint64_type, _uint64_type, _integer_type, SemanticTree.basic_function_type.ulshl, _uint64_type); _ulong_shr = make_common_binary_operation(compiler_string_consts.shr_name, _uint64_type, _uint64_type, _integer_type, SemanticTree.basic_function_type.ulshr, _uint64_type); /*make_function_comparison(_long_add, _ulong_add, function_compare.greater); make_function_comparison(_long_sub, _ulong_sub, function_compare.greater); make_function_comparison(_long_mul, _ulong_mul, function_compare.greater); make_function_comparison(_long_idiv, _ulong_idiv, function_compare.greater); make_function_comparison(_long_mod, _ulong_mod, function_compare.greater); make_function_comparison(_long_gr, _ulong_gr, function_compare.greater); make_function_comparison(_long_greq, _ulong_greq, function_compare.greater); make_function_comparison(_long_sm, _ulong_sm, function_compare.greater); make_function_comparison(_long_smeq, _ulong_smeq, function_compare.greater); make_function_comparison(_long_eq, _ulong_eq, function_compare.greater); make_function_comparison(_long_noteq, _ulong_noteq, function_compare.greater); make_function_comparison(_long_and, _ulong_and, function_compare.greater); make_function_comparison(_long_or, _ulong_or, function_compare.greater); make_function_comparison(_long_xor, _ulong_xor, function_compare.greater);*/ make_function_comparison(_long_add, _ulong_add, function_compare.less); make_function_comparison(_long_sub, _ulong_sub, function_compare.less); make_function_comparison(_long_mul, _ulong_mul, function_compare.less); make_function_comparison(_long_idiv, _ulong_idiv, function_compare.less); make_function_comparison(_long_mod, _ulong_mod, function_compare.less); make_function_comparison(_long_gr, _ulong_gr, function_compare.less); make_function_comparison(_long_greq, _ulong_greq, function_compare.less); make_function_comparison(_long_sm, _ulong_sm, function_compare.less); make_function_comparison(_long_smeq, _ulong_smeq, function_compare.less); make_function_comparison(_long_eq, _ulong_eq, function_compare.less); make_function_comparison(_long_noteq, _ulong_noteq, function_compare.less); make_function_comparison(_long_and, _ulong_and, function_compare.less); make_function_comparison(_long_or, _ulong_or, function_compare.less); make_function_comparison(_long_xor, _ulong_xor, function_compare.less); make_function_comparison(_int_add, _ulong_add, function_compare.less); make_function_comparison(_int_sub, _ulong_sub, function_compare.less); make_function_comparison(_int_mul, _ulong_mul, function_compare.less); make_function_comparison(_int_idiv, _ulong_idiv, function_compare.less); make_function_comparison(_int_mod, _ulong_mod, function_compare.less); make_function_comparison(_int_gr, _ulong_gr, function_compare.less); make_function_comparison(_int_greq, _ulong_greq, function_compare.less); make_function_comparison(_int_sm, _ulong_sm, function_compare.less); make_function_comparison(_int_smeq, _ulong_smeq, function_compare.less); make_function_comparison(_int_eq, _ulong_eq, function_compare.less); make_function_comparison(_int_noteq, _ulong_noteq, function_compare.less); make_function_comparison(_int_and, _ulong_and, function_compare.less); make_function_comparison(_int_or, _ulong_or, function_compare.less); make_function_comparison(_int_xor, _ulong_xor, function_compare.less); /*make_function_comparison(_int_add, _ulong_add, function_compare.greater); make_function_comparison(_int_sub, _ulong_sub, function_compare.greater); make_function_comparison(_int_mul, _ulong_mul, function_compare.greater); make_function_comparison(_int_idiv, _ulong_idiv, function_compare.greater); make_function_comparison(_int_gr, _ulong_gr, function_compare.greater); make_function_comparison(_int_greq, _ulong_greq, function_compare.greater); make_function_comparison(_int_sm, _ulong_sm, function_compare.greater); make_function_comparison(_int_smeq, _ulong_smeq, function_compare.greater); make_function_comparison(_int_eq, _ulong_eq, function_compare.greater); make_function_comparison(_int_noteq, _ulong_noteq, function_compare.greater); make_function_comparison(_int_and, _ulong_and, function_compare.greater); make_function_comparison(_int_or, _ulong_or, function_compare.greater); make_function_comparison(_int_xor, _ulong_xor, function_compare.greater);*/ /*make_function_comparison(_long_add, _ulong_add, function_compare.non_comparable); make_function_comparison(_long_sub, _ulong_sub, function_compare.non_comparable); make_function_comparison(_long_mul, _ulong_mul, function_compare.non_comparable); make_function_comparison(_long_idiv, _ulong_idiv, function_compare.non_comparable); make_function_comparison(_long_mod, _ulong_mod, function_compare.non_comparable); make_function_comparison(_long_gr, _ulong_gr, function_compare.greater); make_function_comparison(_long_greq, _ulong_greq, function_compare.greater); make_function_comparison(_long_sm, _ulong_sm, function_compare.greater); make_function_comparison(_long_smeq, _ulong_smeq, function_compare.greater); make_function_comparison(_long_eq, _ulong_eq, function_compare.greater); make_function_comparison(_long_noteq, _ulong_noteq, function_compare.greater); make_function_comparison(_long_and, _ulong_and, function_compare.greater); make_function_comparison(_long_or, _ulong_or, function_compare.greater); make_function_comparison(_long_xor, _ulong_xor, function_compare.greater); make_function_comparison(_int_add, _ulong_add, function_compare.non_comparable); make_function_comparison(_int_sub, _ulong_sub, function_compare.non_comparable); make_function_comparison(_int_mul, _ulong_mul, function_compare.non_comparable); make_function_comparison(_int_idiv, _ulong_idiv, function_compare.non_comparable); make_function_comparison(_int_gr, _ulong_gr, function_compare.greater); make_function_comparison(_int_greq, _ulong_greq, function_compare.greater); make_function_comparison(_int_sm, _ulong_sm, function_compare.greater); make_function_comparison(_int_smeq, _ulong_smeq, function_compare.greater); make_function_comparison(_int_eq, _ulong_eq, function_compare.greater); make_function_comparison(_int_noteq, _ulong_noteq, function_compare.greater); make_function_comparison(_int_and, _ulong_and, function_compare.greater); make_function_comparison(_int_or, _ulong_or, function_compare.greater); make_function_comparison(_int_xor, _ulong_xor, function_compare.greater); make_common_binary_operation(compiler_string_consts.plus_name, _ulong_type, _ulong_type, _ushort_type, SemanticTree.basic_function_type.uladd, _ulong_type); make_common_binary_operation(compiler_string_consts.minus_name, _ulong_type, _ulong_type, _ushort_type, SemanticTree.basic_function_type.ulsub, _ulong_type); make_common_binary_operation(compiler_string_consts.mul_name, _ulong_type, _ulong_type, _ushort_type, SemanticTree.basic_function_type.ulmul, _ulong_type); make_common_binary_operation(compiler_string_consts.idiv_name, _ulong_type, _ulong_type, _ushort_type, SemanticTree.basic_function_type.uldiv, _ulong_type); make_common_binary_operation(compiler_string_consts.mod_name, _ulong_type, _ulong_type, _ushort_type, SemanticTree.basic_function_type.ulmod, _ulong_type); make_common_binary_operation(compiler_string_consts.plus_name, _ulong_type, _ulong_type, _byte_type, SemanticTree.basic_function_type.uladd, _ulong_type); make_common_binary_operation(compiler_string_consts.minus_name, _ulong_type, _ulong_type, _byte_type, SemanticTree.basic_function_type.ulsub, _ulong_type); make_common_binary_operation(compiler_string_consts.mul_name, _ulong_type, _ulong_type, _byte_type, SemanticTree.basic_function_type.ulmul, _ulong_type); make_common_binary_operation(compiler_string_consts.idiv_name, _ulong_type, _ulong_type, _byte_type, SemanticTree.basic_function_type.uldiv, _ulong_type); make_common_binary_operation(compiler_string_consts.mod_name, _ulong_type, _ulong_type, _byte_type, SemanticTree.basic_function_type.ulmod, _ulong_type);*/ /*make_function_comparison(_ushort_add, _ulong_add, function_compare.less); make_function_comparison(_ushort_sub, _ulong_sub, function_compare.less); make_function_comparison(_ushort_mul, _ulong_mul, function_compare.less); make_function_comparison(_ushort_idiv, _ulong_idiv, function_compare.less); make_function_comparison(_ushort_gr, _ulong_gr, function_compare.less); make_function_comparison(_ushort_greq, _ulong_greq, function_compare.less); make_function_comparison(_ushort_sm, _ulong_sm, function_compare.less); make_function_comparison(_ushort_smeq, _ulong_smeq, function_compare.less); make_function_comparison(_ushort_eq, _ulong_eq, function_compare.less); make_function_comparison(_ushort_noteq, _ulong_noteq, function_compare.less); make_function_comparison(_ushort_and, _ulong_and, function_compare.less); make_function_comparison(_ushort_or, _ulong_or, function_compare.less); make_function_comparison(_ushort_xor, _ulong_xor, function_compare.less); make_function_comparison(_byte_add, _ulong_add, function_compare.less); make_function_comparison(_byte_sub, _ulong_sub, function_compare.less); make_function_comparison(_byte_mul, _ulong_mul, function_compare.less); make_function_comparison(_byte_idiv, _ulong_idiv, function_compare.less); make_function_comparison(_byte_gr, _ulong_gr, function_compare.less); make_function_comparison(_byte_greq, _ulong_greq, function_compare.less); make_function_comparison(_byte_sm, _ulong_sm, function_compare.less); make_function_comparison(_byte_smeq, _ulong_smeq, function_compare.less); make_function_comparison(_byte_eq, _ulong_eq, function_compare.less); make_function_comparison(_byte_noteq, _ulong_noteq, function_compare.less); make_function_comparison(_byte_and, _ulong_and, function_compare.less); make_function_comparison(_byte_or, _ulong_or, function_compare.less); make_function_comparison(_byte_xor, _ulong_xor, function_compare.less);*/ make_function_comparison(_ulong_add, _uint_add, function_compare.greater); make_function_comparison(_ulong_sub, _uint_sub, function_compare.greater); make_function_comparison(_ulong_mul, _uint_mul, function_compare.greater); make_function_comparison(_ulong_idiv, _uint_idiv, function_compare.greater); make_function_comparison(_ulong_mod, _uint_mod, function_compare.greater); make_function_comparison(_ulong_gr, _uint_gr, function_compare.greater); make_function_comparison(_ulong_greq, _uint_greq, function_compare.greater); make_function_comparison(_ulong_sm, _uint_sm, function_compare.greater); make_function_comparison(_ulong_smeq, _uint_smeq, function_compare.greater); make_function_comparison(_ulong_eq, _uint_eq, function_compare.greater); make_function_comparison(_ulong_noteq, _uint_noteq, function_compare.greater); make_function_comparison(_ulong_and, _uint_and, function_compare.greater); make_function_comparison(_ulong_or, _uint_or, function_compare.greater); make_function_comparison(_ulong_xor, _uint_xor, function_compare.greater); //real type. //Assign. _real_assign=make_assign_operator(_double_type, SemanticTree.basic_function_type.dassign); /* _real_to_byte = make_type_conversion(_ulong_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.ultob); _real_to_sbyte = make_type_conversion(_ulong_type, _sbyte_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.ultosb); _real_to_short = make_type_conversion(_ulong_type, _short_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.ultos); _real_to_ushort = make_type_conversion(_ulong_type, _ushort_type, type_compare.greater_type, SemanticTree.basic_function_type.ultous); _real_to_uint = make_type_conversion(_ulong_type, _uint_type, type_compare.greater_type, SemanticTree.basic_function_type.ului); _real_to_long = make_type_conversion(_ulong_type, _long_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.ultol); _real_to_ulong = make_type_conversion(_ulong_type, _long_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.ultol); _real_to_int = make_type_conversion(_ulong_type, _integer_type, type_compare.non_comparable_type, SemanticTree.basic_function_type.ultoi); _real_to_char = make_type_conversion(_ulong_type, _char_type, type_compare.greater_type, SemanticTree.basic_function_type.ultochar); */ _double_to_float = make_type_conversion(_double_type, _float_type, type_compare.greater_type, SemanticTree.basic_function_type.dtof); //Унарные операции. _real_unmin=make_unary_operator(compiler_string_consts.minus_name, _double_type, SemanticTree.basic_function_type.dunmin); //make_empty_operator(compiler_string_consts.plus_name, _real_type); make_unary_empty_operator(compiler_string_consts.plus_name, _double_type, _double_type); //Арифметические операции. _real_add=make_binary_operator(compiler_string_consts.plus_name, _double_type, SemanticTree.basic_function_type.dadd); _real_sub=make_binary_operator(compiler_string_consts.minus_name, _double_type, SemanticTree.basic_function_type.dsub); _real_mul=make_binary_operator(compiler_string_consts.mul_name, _double_type, SemanticTree.basic_function_type.dmul); _real_div=make_binary_operator(compiler_string_consts.div_name, _double_type, SemanticTree.basic_function_type.ddiv); //Опрерации сравнения. _real_gr=make_binary_operator(compiler_string_consts.gr_name, _double_type, SemanticTree.basic_function_type.dgr, _bool_type); _real_greq=make_binary_operator(compiler_string_consts.greq_name, _double_type, SemanticTree.basic_function_type.dgreq, _bool_type); _real_sm=make_binary_operator(compiler_string_consts.sm_name, _double_type, SemanticTree.basic_function_type.dsm, _bool_type); _real_smeq=make_binary_operator(compiler_string_consts.smeq_name, _double_type, SemanticTree.basic_function_type.dsmeq, _bool_type); _real_eq=make_binary_operator(compiler_string_consts.eq_name, _double_type, SemanticTree.basic_function_type.deq, _bool_type); _real_noteq=make_binary_operator(compiler_string_consts.noteq_name, _double_type, SemanticTree.basic_function_type.dnoteq, _bool_type); //float type _float_assign = make_assign_operator(_float_type, SemanticTree.basic_function_type.fassign); _float_to_double = make_type_conversion(_float_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.ftod); //Унарные операции. _float_unmin = make_unary_operator(compiler_string_consts.minus_name, _float_type, SemanticTree.basic_function_type.funmin); //make_empty_operator(compiler_string_consts.plus_name, _real_type); make_unary_empty_operator(compiler_string_consts.plus_name, _float_type, _float_type); //Арифметические операции. _float_add = make_binary_operator(compiler_string_consts.plus_name, _float_type, SemanticTree.basic_function_type.fadd); _float_sub = make_binary_operator(compiler_string_consts.minus_name, _float_type, SemanticTree.basic_function_type.fsub); _float_mul = make_binary_operator(compiler_string_consts.mul_name, _float_type, SemanticTree.basic_function_type.fmul); _float_div = make_binary_operator(compiler_string_consts.div_name, _float_type, SemanticTree.basic_function_type.fdiv); //Опрерации сравнения. _float_gr = make_binary_operator(compiler_string_consts.gr_name, _float_type, SemanticTree.basic_function_type.fgr, _bool_type); _float_greq = make_binary_operator(compiler_string_consts.greq_name, _float_type, SemanticTree.basic_function_type.fgreq, _bool_type); _float_sm = make_binary_operator(compiler_string_consts.sm_name, _float_type, SemanticTree.basic_function_type.fsm, _bool_type); _float_smeq = make_binary_operator(compiler_string_consts.smeq_name, _float_type, SemanticTree.basic_function_type.fsmeq, _bool_type); _float_eq = make_binary_operator(compiler_string_consts.eq_name, _float_type, SemanticTree.basic_function_type.feq, _bool_type); _float_noteq = make_binary_operator(compiler_string_consts.noteq_name, _float_type, SemanticTree.basic_function_type.fnoteq, _bool_type); make_function_comparison(_real_add, _float_add, function_compare.greater); make_function_comparison(_real_sub, _float_sub, function_compare.greater); make_function_comparison(_real_mul, _float_mul, function_compare.greater); make_function_comparison(_real_gr, _float_gr, function_compare.greater); make_function_comparison(_real_greq, _float_greq, function_compare.greater); make_function_comparison(_real_sm, _float_sm, function_compare.greater); make_function_comparison(_real_smeq, _float_smeq, function_compare.greater); make_function_comparison(_real_eq, _float_eq, function_compare.greater); make_function_comparison(_real_noteq, _float_noteq, function_compare.greater); //char type. //Assign. _char_assign = make_assign_operator(_char_type, SemanticTree.basic_function_type.charassign); _char_to_byte = make_type_conversion(_char_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.chartob,false); _char_to_sbyte = make_type_conversion(_char_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.chartosb,false); _char_to_short = make_type_conversion(_char_type, _short_type, type_compare.less_type, SemanticTree.basic_function_type.chartos,false); _char_to_ushort = make_type_conversion(_char_type, _ushort_type, type_compare.less_type, SemanticTree.basic_function_type.chartous,false); _char_to_uint = make_type_conversion(_char_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.chartoui,false); _char_to_long = make_type_conversion(_char_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.chartol,false); _char_to_ulong = make_type_conversion(_char_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.chartoul,false); _char_to_int = make_type_conversion(_char_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.chartoi, false); _char_to_float = make_type_conversion(_char_type, _float_type, type_compare.less_type, SemanticTree.basic_function_type.chartof, false); _char_to_double = make_type_conversion(_char_type, _double_type, type_compare.less_type, SemanticTree.basic_function_type.chartod, false); //Опрерации сравнения. _char_gr = make_binary_operator(compiler_string_consts.gr_name, _char_type, SemanticTree.basic_function_type.chargr, _bool_type); _char_greq = make_binary_operator(compiler_string_consts.greq_name, _char_type, SemanticTree.basic_function_type.chargreq, _bool_type); _char_sm = make_binary_operator(compiler_string_consts.sm_name, _char_type, SemanticTree.basic_function_type.charsm, _bool_type); _char_smeq = make_binary_operator(compiler_string_consts.smeq_name, _char_type, SemanticTree.basic_function_type.charsmeq, _bool_type); _char_eq = make_binary_operator(compiler_string_consts.eq_name, _char_type, SemanticTree.basic_function_type.chareq, _bool_type); _char_noteq = make_binary_operator(compiler_string_consts.noteq_name, _char_type, SemanticTree.basic_function_type.charnoteq, _bool_type); //boolean type. //Assign. _bool_assign=make_assign_operator(_bool_type, SemanticTree.basic_function_type.boolassign); //Логические операции. //Унарные операции. _bool_not=make_unary_operator(compiler_string_consts.not_name, _bool_type, SemanticTree.basic_function_type.boolnot); //Логическме операции. _bool_and=make_binary_operator(compiler_string_consts.and_name, _bool_type, SemanticTree.basic_function_type.booland); _bool_or=make_binary_operator(compiler_string_consts.or_name, _bool_type, SemanticTree.basic_function_type.boolor); _bool_xor=make_binary_operator(compiler_string_consts.xor_name, _bool_type, SemanticTree.basic_function_type.boolxor); //Опрерации сравнения. _bool_gr=make_binary_operator(compiler_string_consts.gr_name, _bool_type, SemanticTree.basic_function_type.boolgr); _bool_greq=make_binary_operator(compiler_string_consts.greq_name, _bool_type, SemanticTree.basic_function_type.boolgreq); _bool_sm=make_binary_operator(compiler_string_consts.sm_name, _bool_type, SemanticTree.basic_function_type.boolsm); _bool_smeq=make_binary_operator(compiler_string_consts.smeq_name, _bool_type, SemanticTree.basic_function_type.boolsmeq); _bool_eq=make_binary_operator(compiler_string_consts.eq_name, _bool_type, SemanticTree.basic_function_type.booleq); _bool_noteq=make_binary_operator(compiler_string_consts.noteq_name, _bool_type, SemanticTree.basic_function_type.boolnoteq); _bool_to_int=make_type_conversion(_bool_type, _integer_type, type_compare.less_type, SemanticTree.basic_function_type.booltoi, false); _bool_to_byte = make_type_conversion(_bool_type, _byte_type, type_compare.greater_type, SemanticTree.basic_function_type.booltob, false); _bool_to_sbyte = make_type_conversion(_bool_type, _sbyte_type, type_compare.greater_type, SemanticTree.basic_function_type.booltosb, false); _bool_to_short = make_type_conversion(_bool_type, _short_type, type_compare.less_type, SemanticTree.basic_function_type.booltos, false); _bool_to_ushort = make_type_conversion(_bool_type, _ushort_type, type_compare.less_type, SemanticTree.basic_function_type.booltous, false); _bool_to_uint = make_type_conversion(_bool_type, _uint_type, type_compare.less_type, SemanticTree.basic_function_type.booltoui, false); _bool_to_long = make_type_conversion(_bool_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.booltol, false); _bool_to_ulong = make_type_conversion(_bool_type, _uint64_type, type_compare.less_type, SemanticTree.basic_function_type.booltoul, false); _obj_to_obj=make_unary_function(_object_type, SemanticTree.basic_function_type.objtoobj, _object_type); //TODO: Закончить с инициализацией строк. make_assign_operator(_string_type, SemanticTree.basic_function_type.objassign); _string_add = make_binary_compiled_operator(_string_type, compiler_string_consts.string_concat_method_name, compiler_string_consts.plus_name); _char_add = make_binary_compiled_operator(_string_type, _char_type, compiler_string_consts.string_concat_method_name, compiler_string_consts.plus_name, _char_type); init_reference_type(_object_type); //mark_byte_as_ordinal(); //mark_int_as_ordinal(); //mark_char_as_ordinal(); //+= -= *= /= _byte_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _byte_type); _byte_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _byte_type); _byte_multassign = make_binary_operator(compiler_string_consts.multassign_name, _byte_type); _byte_divassign = make_binary_operator(compiler_string_consts.divassign_name, _byte_type); _sbyte_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _sbyte_type); _sbyte_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _sbyte_type); _sbyte_multassign = make_binary_operator(compiler_string_consts.multassign_name, _sbyte_type); _sbyte_divassign = make_binary_operator(compiler_string_consts.divassign_name, _sbyte_type); _short_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _short_type); _short_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _short_type); _short_multassign = make_binary_operator(compiler_string_consts.multassign_name, _short_type); _short_divassign = make_binary_operator(compiler_string_consts.divassign_name, _short_type); _ushort_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _ushort_type); _ushort_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _ushort_type); _ushort_multassign = make_binary_operator(compiler_string_consts.multassign_name, _ushort_type); _ushort_divassign = make_binary_operator(compiler_string_consts.divassign_name, _ushort_type); _int_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _integer_type); _int_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _integer_type); _int_multassign = make_binary_operator(compiler_string_consts.multassign_name, _integer_type); _int_divassign = make_binary_operator(compiler_string_consts.divassign_name, _integer_type); _uint_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _uint_type); _uint_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _uint_type); _uint_multassign = make_binary_operator(compiler_string_consts.multassign_name, _uint_type); _uint_divassign = make_binary_operator(compiler_string_consts.divassign_name, _uint_type); _long_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _int64_type); _long_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _int64_type); _long_multassign = make_binary_operator(compiler_string_consts.multassign_name, _int64_type); _long_divassign = make_binary_operator(compiler_string_consts.divassign_name, _int64_type); _ulong_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _uint64_type); _ulong_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _uint64_type); _ulong_multassign = make_binary_operator(compiler_string_consts.multassign_name, _uint64_type); _ulong_divassign = make_binary_operator(compiler_string_consts.divassign_name, _uint64_type); _float_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _float_type); _float_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _float_type); _float_multassign = make_binary_operator(compiler_string_consts.multassign_name, _float_type); _float_divassign = make_binary_operator(compiler_string_consts.divassign_name, _float_type); _double_plusassign = make_binary_operator(compiler_string_consts.plusassign_name, _double_type); _double_minusassign = make_binary_operator(compiler_string_consts.minusassign_name, _double_type); _double_multassign = make_binary_operator(compiler_string_consts.multassign_name, _double_type); _double_divassign = make_binary_operator(compiler_string_consts.divassign_name, _double_type); mark_type_as_ordinal(_integer_type, SemanticTree.basic_function_type.iinc, SemanticTree.basic_function_type.idec, SemanticTree.basic_function_type.isinc, SemanticTree.basic_function_type.isdec, new int_const_node(int.MinValue,null), new int_const_node(int.MaxValue,null), create_emty_function(_integer_type,null), int_to_int); mark_type_as_ordinal(_uint_type, SemanticTree.basic_function_type.uiinc, SemanticTree.basic_function_type.uidec, SemanticTree.basic_function_type.uisinc, SemanticTree.basic_function_type.uisdec, new uint_const_node(uint.MinValue, null), new uint_const_node(uint.MaxValue, null), _uint_to_int, uint_to_int); mark_type_as_ordinal(_int64_type, SemanticTree.basic_function_type.linc, SemanticTree.basic_function_type.ldec, SemanticTree.basic_function_type.lsinc, SemanticTree.basic_function_type.lsdec, new long_const_node(long.MinValue, null), new long_const_node(long.MaxValue, null), _long_to_int, long_to_int); mark_type_as_ordinal(_uint64_type, SemanticTree.basic_function_type.ulinc, SemanticTree.basic_function_type.uldec, SemanticTree.basic_function_type.ulsinc, SemanticTree.basic_function_type.ulsdec, new ulong_const_node(ulong.MinValue, null), new ulong_const_node(ulong.MaxValue, null), _ulong_to_int, ulong_to_int); mark_type_as_ordinal(_byte_type, SemanticTree.basic_function_type.binc, SemanticTree.basic_function_type.bdec, SemanticTree.basic_function_type.bsinc, SemanticTree.basic_function_type.bsdec, new byte_const_node(byte.MinValue, null), new byte_const_node(byte.MaxValue, null), _byte_to_int, byte_to_int); mark_type_as_ordinal(_sbyte_type, SemanticTree.basic_function_type.sbinc, SemanticTree.basic_function_type.sbdec, SemanticTree.basic_function_type.sbsinc, SemanticTree.basic_function_type.sbsdec, new sbyte_const_node(sbyte.MinValue, null), new sbyte_const_node(sbyte.MaxValue, null), _sbyte_to_int, sbyte_to_int); mark_type_as_ordinal(_short_type, SemanticTree.basic_function_type.sinc, SemanticTree.basic_function_type.sdec, SemanticTree.basic_function_type.ssinc, SemanticTree.basic_function_type.ssdec, new short_const_node(short.MinValue, null), new short_const_node(short.MaxValue, null), _short_to_int, short_to_int); mark_type_as_ordinal(_ushort_type, SemanticTree.basic_function_type.usinc, SemanticTree.basic_function_type.usdec, SemanticTree.basic_function_type.ussinc, SemanticTree.basic_function_type.ussdec, new ushort_const_node(ushort.MinValue, null), new ushort_const_node(ushort.MaxValue, null), _ushort_to_int, ushort_to_int); mark_type_as_ordinal(_char_type, SemanticTree.basic_function_type.cinc, SemanticTree.basic_function_type.cdec, SemanticTree.basic_function_type.csinc, SemanticTree.basic_function_type.csdec, new char_const_node(char.MinValue, null), new char_const_node(char.MaxValue, null), _char_to_int, char_to_int); mark_type_as_ordinal(_bool_type, SemanticTree.basic_function_type.boolinc, SemanticTree.basic_function_type.booldec, SemanticTree.basic_function_type.boolsinc, SemanticTree.basic_function_type.boolsdec, new bool_const_node(false, null), new bool_const_node(true, null), _bool_to_int, bool_to_int); _empty_string = new string_const_node(string.Empty, null); _dllimport_type = compiled_type_node.get_type_node(typeof(System.Runtime.InteropServices.DllImportAttribute)); _flags_attribute_type = compiled_type_node.get_type_node(typeof(System.FlagsAttribute)); _usage_attribute_type = compiled_type_node.get_type_node(typeof(AttributeUsageAttribute)); _comimport_type = compiled_type_node.get_type_node(typeof(System.Runtime.InteropServices.ComImportAttribute)); _attribute_type = compiled_type_node.get_type_node(typeof(Attribute)); _field_offset_attribute_type = compiled_type_node.get_type_node(typeof(System.Runtime.InteropServices.FieldOffsetAttribute)); _struct_layout_attribute_type = compiled_type_node.get_type_node(typeof(System.Runtime.InteropServices.StructLayoutAttribute)); string[] s=new string[0]; _array_of_string = compiled_type_node.get_type_node(s.GetType()); make_type_conversion_use_ctor(_float_type, _decimal_type, type_compare.less_type, true); make_type_conversion_use_ctor(_double_type, _decimal_type, type_compare.less_type, true); //это преобразование есть явно в decimal //make_type_conversion_use_ctor(_integer_type, _decimal_type, type_compare.less_type, true); make_type_conversion_use_ctor(_uint_type, _decimal_type, type_compare.less_type, true); make_type_conversion_use_ctor(_uint64_type, _decimal_type, type_compare.less_type, true); writable_in_typed_files_types.Clear(); writable_in_typed_files_types.Add(_bool_type, _bool_type); writable_in_typed_files_types.Add(_byte_type, _byte_type); writable_in_typed_files_types.Add(_sbyte_type, _sbyte_type); writable_in_typed_files_types.Add(_short_type, _short_type); writable_in_typed_files_types.Add(_ushort_type, _ushort_type); writable_in_typed_files_types.Add(_integer_type, _integer_type); writable_in_typed_files_types.Add(_uint_type, _uint_type); writable_in_typed_files_types.Add(_int64_type, _int64_type); writable_in_typed_files_types.Add(_uint64_type, _uint64_type); writable_in_typed_files_types.Add(_double_type, _double_type); writable_in_typed_files_types.Add(_char_type, _char_type); writable_in_typed_files_types.Add(_float_type, _float_type); foreach (type_node tn in wait_add_ref_list) init_reference_type(tn); wait_add_ref_list.Clear(); _exception_base_type = compiled_type_node.get_type_node(typeof(System.Exception), symtab); _exception_base_type.SetName(compiler_string_consts.base_exception_class_name); }
public static_compiled_variable_reference(compiled_variable_definition var,location loc) : base(var.type,loc) { _var=var; _type=_var.cont_type; }
public static function_node get_explicit_conversion(compiled_type_node in_type, compiled_type_node from, compiled_type_node to, NetTypeScope scope) { return get_conversion(in_type, from, to, compiler_string_consts.explicit_operator_name, scope); }
public static compiled_function_node get_implicit_conversion(compiled_type_node in_type, compiled_type_node from, compiled_type_node to) { return get_conversion(in_type, from, to, compiler_string_consts.implicit_operator_name); }
//TODO: Сделать поля одиночками. public compiled_variable_definition(System.Reflection.FieldInfo fi) : base(fi.Name,compiled_type_node.get_type_node(fi.FieldType)) { _fi=fi; _cont_type=compiled_type_node.get_type_node(fi.DeclaringType); }
private static compiled_function_node get_conversion(compiled_type_node in_type,compiled_type_node from, compiled_type_node to,string op_name) { MethodInfo[] mia = in_type.compiled_type.GetMethods(); foreach (MethodInfo mi in mia) { if (mi.Name != op_name) { continue; } if (mi.ReturnType != to.compiled_type) { continue; } ParameterInfo[] piarr = mi.GetParameters(); if (piarr.Length != 1) { continue; } if (piarr[0].ParameterType != from.compiled_type) { continue; } return compiled_function_node.get_compiled_method(mi); } return null; /*Type[] arr = new Type[1]; arr[0] = from.compiled_type; MethodInfo mi=in_type.compiled_type.GetMethod(op_name,arr); if (mi == null) { return null; } if (mi.ReturnType != to.compiled_type) { return null; } return compiled_function_node.get_compiled_method(mi); */ }
public void leave_type_method() { if (_explicit_interface_type != null) { function_node fn = top_function; SymbolInfo si = _ctn.Scope.FindOnlyInType(fn.name, null); function_node compar; while (si != null) { compar = si.sym_info as function_node; if (fn != compar && convertion_data_and_alghoritms.function_eq_params(fn, compar)) //if (fn is common_namespace_function_node && compar is common_namespace_function_node && (fn as common_namespace_function_node).comprehensive_namespace == (compar as common_namespace_function_node).comprehensive_namespace) AddError(new FunctionDuplicateDefinition(compar, fn)); si = si.Next; } } else if (_compiled_tn != null) { function_node fn = top_function; SymbolInfo si = _compiled_tn.scope.FindOnlyInType(fn.name, null); function_node compar; while (si != null) { compar = si.sym_info as function_node; if (fn!=compar && convertion_data_and_alghoritms.function_eq_params(fn, compar,false)) //if (fn is common_namespace_function_node && compar is common_namespace_function_node && (fn as common_namespace_function_node).comprehensive_namespace == (compar as common_namespace_function_node).comprehensive_namespace) AddError(new FunctionDuplicateDefinition(compar, fn)); si = si.Next; } } if (_explicit_interface_type == null) _ctn = null; _compiled_tn = null; _explicit_interface_type = null; }
//\ssyy //(ssyy) возвращаемое значение заменено на definition_node из-за шаблонов public definition_node enter_in_type_method(SyntaxTree.method_name meth_name, string type_name, location loc, int num_template_args) { // num_template_args - это количество обобщенных аргументов в классе (не в методе!) SymbolInfo si = null; if (meth_name.ln!=null && meth_name.ln.Count > 1) { // обработать эту ситуацию особо тщательно: в ln - список возможных пространств имен с классом (возможно, обобщенным) на конце // если в ln какое-то имя кроме последнего, содержит обобщенные параметры - это ошибка for (var i = 0; i < meth_name.ln.Count - 1; i++) if (meth_name.ln[i] is SyntaxTree.template_type_name) AddError(new NameCannotHaveGenericParameters(meth_name.ln[i].name, syntax_tree_visitor.get_location(meth_name.ln[i]))); var ntr = new SyntaxTree.named_type_reference(); for (var i = 0; i < meth_name.ln.Count; i++) ntr.Add(meth_name.ln[i]); if (num_template_args>0 && ! ntr.names[meth_name.ln.Count-1].name.Contains(compiler_string_consts.generic_params_infix)) { ntr.names[meth_name.ln.Count-1].name += compiler_string_consts.generic_params_infix + num_template_args; } si = find_definition_node(ntr, loc); // если не нашли, то ошибка будет неправильной с неправильным именем - надо исправить } else { if (num_template_args != 0) { string template_type_name = type_name + compiler_string_consts.generic_params_infix + num_template_args.ToString(); si = find(template_type_name); /*if (si == null || si.sym_info.general_node_type != general_node_type.template_type) { type_name = type_name + compiler_string_consts.generic_params_infix + num_template_args.ToString(); si = null; }*/ } if (si == null) { si = find(type_name); } } if (si == null) { AddError(new UndefinedNameReference(type_name, loc)); } definition_node dn = si.sym_info; if (dn.general_node_type == general_node_type.template_type) { _ctt = dn as template_class; if (_cmn != _ctt.cnn && _ctt.using_list2 == null) { //Заполняем список using для внешних методов _ctt.using_list2 = new using_namespace_list(); foreach(using_namespace un in syntax_tree_visitor.using_list) { _ctt.using_list2.AddElement(un); } } return dn; } if (dn.general_node_type == general_node_type.generic_indicator) { dn = (dn as generic_indicator).generic; } if (dn is compiled_type_node) { _compiled_tn = dn as compiled_type_node; return dn; } if (dn.general_node_type != general_node_type.type_node) { AddError(loc, "TYPE_NAME_EXPECTED"); } #if DEBUG if (si.Next != null) { throw new CompilerInternalError("Must find only type, found some other."); } #endif if (dn.semantic_node_type != semantic_node_type.common_type_node) { AddError(loc, "ONLY_COMMON_TYPE_METHOD_DEFINITION_ALLOWED"); } //TODO: В случае создания вложенных классов этот код надо поправить. common_type_node ctn = dn as common_type_node; _ctn = ctn; return ctn; }
private static void InitEnumOperations(compiled_type_node ctn) { if (ctn.compiled_type.GetCustomAttributes(typeof(FlagsAttribute), true).Length == 0) return; basic_function_node _int_and = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.and_name, ctn, SemanticTree.basic_function_type.iand); basic_function_node _int_or = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.or_name, ctn, SemanticTree.basic_function_type.ior); basic_function_node _int_xor = SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.xor_name, ctn, SemanticTree.basic_function_type.ixor); if (ctn.scope != null) { ctn.scope.AddSymbol(compiler_string_consts.and_name, new SymbolInfo(_int_and)); ctn.scope.AddSymbol(compiler_string_consts.or_name, new SymbolInfo(_int_or)); ctn.scope.AddSymbol(compiler_string_consts.xor_name, new SymbolInfo(_int_xor)); } }
public static compiled_type_node get_array_type(compiled_type_node element_type) { return (compiled_type_node.get_type_node(element_type.compiled_type.MakeArrayType())); }
public static compiled_type_node get_type_node(System.Type st) { //(ssyy) Обрабатываем параметры generic-типов //Сделаю потом, если это понадобится. //if (st.IsGenericParameter) //{ //} //if (st.Name.EndsWith("&") == true) //(ssyy) Лучше так if (st.IsByRef) { //return get_type_node(st.Module.GetType(st.FullName.Substring(0,st.FullName.Length-1))); return get_type_node(st.GetElementType()); } compiled_type_node ctn;//=compiled_types[st]; if (compiled_types.TryGetValue(st, out ctn)) { //ctn.reinit_scope(); return ctn; } ctn=new compiled_type_node(st); //Если это не чистить, будет ошибка. Т.к. при следующей компиляции области видимости могут изменится. //Но если это чистить то тоже ошибка. нужна еще одна статическая таблица для стандартных типов compiled_types[st] = ctn; ctn.init_constructors(); ctn.mark_if_delegate(); ctn.mark_if_array(); if (st.IsEnum) { internal_interface ii = SystemLibrary.SystemLibrary.integer_type.get_internal_interface(internal_interface_kind.ordinal_interface); ordinal_type_interface oti_old = (ordinal_type_interface)ii; enum_const_node lower_value = new enum_const_node(0, ctn, ctn.loc); enum_const_node upper_value = new enum_const_node(st.GetFields().Length-2, ctn, ctn.loc); ordinal_type_interface oti_new = new ordinal_type_interface(oti_old.inc_method, oti_old.dec_method, oti_old.inc_value_method, oti_old.dec_value_method, oti_old.lower_eq_method, oti_old.greater_eq_method, oti_old.lower_method, oti_old.greater_method, lower_value, upper_value, oti_old.value_to_int, oti_old.ordinal_type_to_int); ctn.add_internal_interface(oti_new); SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.gr_name, ctn, SemanticTree.basic_function_type.enumgr, SystemLibrary.SystemLibrary.bool_type); SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.greq_name, ctn, SemanticTree.basic_function_type.enumgreq, SystemLibrary.SystemLibrary.bool_type); SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.sm_name, ctn, SemanticTree.basic_function_type.enumsm, SystemLibrary.SystemLibrary.bool_type); SystemLibrary.SystemLibrary.make_binary_operator(compiler_string_consts.smeq_name, ctn, SemanticTree.basic_function_type.enumsmeq, SystemLibrary.SystemLibrary.bool_type); InitEnumOperations(ctn); } //ctn.init_scope(); //TODO: Тут надо подумать. Может как-то сделать по другому? if (!NetHelper.NetHelper.IsStandType(st)) { SystemLibrary.SystemLibrary.init_reference_type(ctn); } return ctn; }
public static compiled_type_node get_array_type(compiled_type_node element_type, int rank) { if (rank == 1) return (compiled_type_node.get_type_node(element_type.compiled_type.MakeArrayType())); else return (compiled_type_node.get_type_node(element_type.compiled_type.MakeArrayType(rank))); }
/// <summary> /// Конструктор узла. /// </summary> /// <param name="mi">Оборачиваемый метод.</param> private compiled_function_node(System.Reflection.MethodInfo mi) { _mi=mi; type_node ret_val=null; if (_mi.ReturnType!=null) { ret_val=compiled_type_node.get_type_node(mi.ReturnType); if (ret_val == SystemLibrary.SystemLibrary.void_type) { ret_val = null; } } System.Reflection.ParameterInfo[] pinf=mi.GetParameters(); parameter_list pal = new parameter_list(); //if (!(_mi.IsGenericMethod)) { int i = 1; foreach (System.Reflection.ParameterInfo pi in pinf) { Type t = null; type_node par_type = null; SemanticTree.parameter_type pt = SemanticTree.parameter_type.value; // if (pi.ParameterType.Name.EndsWith("&") == true) //(ssyy) Лучше так: if (pi.ParameterType.IsByRef) { //t = pi.ParameterType.Assembly.GetType(pi.ParameterType.FullName.Substring(0, pi.ParameterType.FullName.Length - 1)); //(ssyy) Лучше так: t = pi.ParameterType.GetElementType(); par_type = compiled_type_node.get_type_node(t); pt = SemanticTree.parameter_type.var; } else { if (pi.Position == 0) { par_type = compiled_type_node.get_type_node(pi.ParameterType); if (NetHelper.NetHelper.IsExtensionMethod(mi)) { connected_to_type = par_type as compiled_type_node; } } } string name = pi.Name; compiled_parameter crpar = new compiled_parameter(pi); crpar.SetParameterType(pt); pal.AddElement(crpar); if (pi.IsOptional && pi.DefaultValue != null) _num_of_default_parameters++; i++; } } //else if (_mi.IsGenericMethod) { _generic_params_count = mi.GetGenericArguments().Length; } _is_extension_method = NetHelper.NetHelper.IsExtensionMethod(mi); this.return_value_type=ret_val; this.parameters.AddRange(pal); }
public static compiled_function_node get_compiled_method(compiled_type_node declaring_type, string method_name, params compiled_type_node[] operands) { Type[] arr = new Type[operands.Length]; for (int i = 0; i < operands.Length; i++) { arr[i] = operands[i].compiled_type; } MethodInfo mi = declaring_type.compiled_type.GetMethod(method_name, arr); compiled_function_node cfn = compiled_function_node.get_compiled_method(mi); return cfn; }
public static compiled_constructor_node make_type_conversion_use_ctor(compiled_type_node from, compiled_type_node to, type_compare tc, bool is_implicit) { Type[] ctor_params = new Type[1]; ctor_params[0] = from.compiled_type; System.Reflection.ConstructorInfo ci = to.compiled_type.GetConstructor(ctor_params); compiled_constructor_node conv_method = null; if (ci != null) { conv_method = compiled_constructor_node.get_compiled_constructor(ci); type_table.add_type_conversion_from_defined(from, to, conv_method, tc, is_implicit); } return conv_method; }
private static function_node get_conversion(compiled_type_node in_type,compiled_type_node from, compiled_type_node to,string op_name, NetTypeScope scope) { //MethodInfo[] mia = in_type.compiled_type.GetMethods(); List<MemberInfo> mia = GetMembers(in_type.compiled_type, op_name); foreach (MemberInfo mbi in mia) { if (!(mbi is MethodInfo)) continue; MethodInfo mi = mbi as MethodInfo; if (mi.ReturnType != to.compiled_type) { continue; } ParameterInfo[] piarr = mi.GetParameters(); if (piarr.Length != 1) { continue; } if (piarr[0].ParameterType != from.compiled_type) { continue; } return compiled_function_node.get_compiled_method(mi); } if (scope != null) { SymbolInfo si = scope.FindOnlyInType(op_name, scope); while (si != null) { if (si.sym_info is common_namespace_function_node) { function_node fn = si.sym_info as function_node; if (fn.return_value_type == to && fn.parameters.Count == 1 && fn.parameters[0].type == from) { return fn; } } si = si.Next; } } return null; }
private static function_node make_binary_compiled_operator(compiled_type_node declaring_type, compiled_type_node add_to_type, string method_name, string new_name, compiled_type_node operand_type) { compiled_function_node fn = NetHelper.NetHelper.get_compiled_method(declaring_type, method_name, operand_type, operand_type); add_to_type.add_name(new_name, new SymbolInfo(fn)); fn.IsOperator = true; return fn; }
/// <summary> /// Конструктор класса. /// </summary> public compiled_class_constant_definition(System.Reflection.FieldInfo fi, constant_node cn) : base(fi.Name, cn, null) { _comprehensive_type = compiled_type_node.get_type_node(fi.DeclaringType); _fi = fi; }
//\ssyy //получения ссылки на откомпилированный тип private int GetCompiledTypeReference(compiled_type_node ctn) { ImportedEntity ie = null; if (ext_members.TryGetValue(ctn, out ie)) { return ie.index * ie.GetSize(); } ie = new ImportedEntity(); ie.index = imp_entitles.Count; ie.flag = ImportKind.DotNet; ie.num_unit = GetAssemblyToken(ctn.compiled_type.Assembly); //ie.offset = (int)ctn.compiled_type.MetadataToken; ie.offset = GetTokenForNetEntity(ctn.compiled_type); int offset = imp_entitles.Count*ie.GetSize(); imp_entitles.Add(ie); ext_members[ctn] = ie; return offset; }
public SymbolInfo(compiled_type_node value) { //_name_information_type=name_information_type.nit_compiled_type; _sym_info=value; _access_level=access_level.al_public; _symbol_kind=symbol_kind.sk_none; }
//\ssyy private string GetSynonimName(common_namespace_node cnn, compiled_type_node ctn) { for (int i = 0; i < cnn.type_synonyms.Count; i++) { if (cnn.type_synonyms[i].original_type == ctn) return cnn.type_synonyms[i].name; } return ctn.name; }
public common_function_node create_function(string name,location def_loc, bool add_symbol_info) { if (converting_block() == block_type.compiled_type_block) { _compiled_tn = compiled_type_node.get_type_node(_compiled_tn.compiled_type,this.syntax_tree_visitor.SymbolTable); } check_function_name(name, def_loc); common_function_node cfn = null; switch (converting_block()) { case block_type.function_block: { common_function_node top_func = _func_stack.top(); SymbolTable.Scope scope = convertion_data_and_alghoritms.symbol_table.CreateScope(top_func.scope); common_in_function_function_node ciffn; ciffn=new common_in_function_function_node(name,def_loc,top_func,scope); top_func.functions_nodes_list.AddElement(ciffn); _last_created_function = new SymbolInfo(ciffn); if (add_symbol_info) top_func.scope.AddSymbol(name, _last_created_function); cfn=ciffn; break; } case block_type.type_block: { if (!extension_method) { common_method_node cmmn; SymbolTable.Scope scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope(_cmn.scope, _ctn.Scope); //TODO:сделать static и virtual. //TODO: interface and implementation scopes. cmmn = new common_method_node(name, def_loc, _ctn, SemanticTree.polymorphic_state.ps_common, _fal, scope); _last_created_function = new SymbolInfo(cmmn); if (add_symbol_info) _ctn.Scope.AddSymbol(name, _last_created_function); _ctn.methods.AddElement(cmmn); cfn = cmmn; } else { common_namespace_function_node cnfnn; SymbolTable.Scope scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope(_cmn.scope, _ctn.scope); cnfnn = new common_namespace_function_node(name, def_loc, _cmn, scope); //_cmn.functions.AddElement(cnfnn); syntax_tree_visitor.compiled_unit.namespaces[0].functions.AddElement(cnfnn); cnfnn.ConnectedToType = _ctn; _last_created_function = new SymbolInfo(cnfnn); if (add_symbol_info) _ctn.scope.AddSymbol(name, _last_created_function); cfn = cnfnn; } break; } case block_type.compiled_type_block: { //string cname = compiler_string_consts.GetConnectedFunctionName(_compiled_tn.name, name); common_namespace_function_node cnfnn; SymbolTable.Scope scope = convertion_data_and_alghoritms.symbol_table.CreateClassMethodScope(_cmn.scope, _compiled_tn.scope); cnfnn = new common_namespace_function_node(name, def_loc, _cmn, scope); //_cmn.functions.AddElement(cnfnn); syntax_tree_visitor.compiled_unit.namespaces[0].functions.AddElement(cnfnn); cnfnn.ConnectedToType = _compiled_tn; _last_created_function = new SymbolInfo(cnfnn); if (add_symbol_info) _compiled_tn.scope.AddSymbol(name, _last_created_function); SymbolInfo sss = _compiled_tn.find_in_type("Hello"); cfn = cnfnn; //if(_compiled_tn.compiled_type.IsPrimitive) // syntax_tree_visitor.WarningsList.Add(new PascalABCCompiler.Errors.CompilerWarning break; } case block_type.namespace_block: { common_namespace_function_node cnfnn; SymbolTable.Scope scope = convertion_data_and_alghoritms.symbol_table.CreateScope(_cmn.scope); cnfnn=new common_namespace_function_node(name,def_loc,_cmn,scope); _cmn.functions.AddElement(cnfnn); _last_created_function=new SymbolInfo(cnfnn); if (add_symbol_info) _cmn.scope.AddSymbol(name,_last_created_function); cfn=cnfnn; break; } } _func_stack.push(cfn); return cfn; }