public function_node is_exist_eq_method_in_list(function_node fn,function_node_list funcs) { return find_eq_method_in_list(fn,funcs); /*if (fn==null) { return false; } return true;*/ }
private void WriteGenericMethodReference(function_node meth) { common_method_node cnode = meth.original_function as common_method_node; if (cnode != null) { bw.Write((byte)PCUConsts.common_method_generic); WriteMethodReference(cnode); } else { compiled_function_node comp = meth.original_function as compiled_function_node; bw.Write((byte)PCUConsts.compiled_method_generic); WriteCompiledMethod(comp); } WriteTypeList(meth.get_generic_params_list()); }
//связываем сущность со смещением, по которому находится тело методов private void SaveCodeReference(function_node fn) { func_codes[fn] = (int)bw.BaseStream.Position; }
/*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 void add_generated_funtion_to_type(string oper_name, type_node to, function_node fn) { to.add_generated_name(oper_name, new SymbolInfo(fn)); }
public function_intersection_node(function_node left, function_node right) { _left = left; _right = right; }
private function_intersection_node get_intersecion(function_node _func) { function_intersection_node _fint = null; bool ret = _func_intersections.TryGetValue(_func, out _fint); if (!ret) { return null; } return _fint; }
private base_function_call_list create_possible_delegates_list(expression_node obj, function_node func, location loc, bool is_static) { function_node_list fnl = new function_node_list(); fnl.AddElement(func); return convert_functions_to_calls(obj, fnl, loc, is_static); }
internal typed_expression make_delegate_wrapper(expression_node obj, function_node func, location loc, bool is_static) { base_function_call_list fnl = create_possible_delegates_list(obj, func, loc, is_static); if (fnl.Count == 0) { if (is_static) { AddError(loc, "EXPECTED_STATIC_METHOD"); } else { AddError(loc, "EXPECTED_NON_STATIC_METHOD"); } } delegated_methods dm = new delegated_methods(); dm.proper_methods.AddRange(fnl); typed_expression te = new typed_expression(dm, loc); return te; }
private bool FunctionExsistsInSymbolInfo(function_node fn, SymbolInfo si) { while (si != null) { if (si.sym_info is function_node) if (convertion_data_and_alghoritms.function_eq_params(fn, si.sym_info as function_node)) return true; si = si.Next; } return false; }
internal common_type_node CreateDelegate(function_node fn) { common_type_node del = convertion_data_and_alghoritms.type_constructor.create_delegate(context.get_delegate_type_name(), fn.return_value_type, fn.parameters, context.converted_namespace, null); context.converted_namespace.types.AddElement(del); return del; }
/// <summary> /// Проверяет, что оператор статический метод класса. /// </summary> /// <param name="fn">Функция-оператор.</param> public void check_operator(function_node fn) { switch (fn.semantic_node_type) { case semantic_node_type.common_in_function_function_node: { throw new CompilerInternalError("Operator can not be nested in function function."); } case semantic_node_type.common_method_node: { common_method_node cmn=(common_method_node)fn; if (cmn.polymorphic_state!=SemanticTree.polymorphic_state.ps_static) { throw new CompilerInternalError("Operator can not be non static method"); } break; } case semantic_node_type.compiled_function_node: { compiled_function_node cfn=(compiled_function_node)fn; if (cfn.polymorphic_state!=SemanticTree.polymorphic_state.ps_static) { throw new CompilerInternalError("Operator can not be non static method. Included library is can be corrupted or library data extraction error."); } break; } } }
//Метод только для внутнреннего использования. //НЕ ПРЕОБРАЗУЕТ ТИПЫ. Только создает узел вызова метода. //Этот метод и используется для создания узлов преобразования типов. //TODO: Переименовать. public expression_node create_simple_function_call(function_node fn, location loc, params expression_node[] exprs) { if (fn.compile_time_executor != null) { expression_node ex = fn.compile_time_executor(loc, exprs); if (ex != null) { return ex; } } switch (fn.semantic_node_type) { /* case semantic_node_type.empty_function_node: { #if (DEBUG) if (exprs.Length!=1) { throw new CompilerInternalError("Epty functions with only single parameter allowed."); } #endif return exprs[0]; } */ case semantic_node_type.basic_function_node: { return create_basic_function_call((basic_function_node)fn, loc, exprs); } case semantic_node_type.common_namespace_function_node: { return create_common_namespace_function_call((common_namespace_function_node)fn, loc, exprs); } case semantic_node_type.common_method_node: { common_method_node cmn = (common_method_node)fn; if (cmn.polymorphic_state != SemanticTree.polymorphic_state.ps_static) { break; } return create_common_static_method_call(cmn, loc, exprs); } /* case semantic_node_type.pseudo_function: { pseudo_function pf=(pseudo_function)fn; return pf.execute_pseudo_function_algorithm(loc,exprs); } */ case semantic_node_type.common_in_function_function_node: break; case semantic_node_type.compiled_function_node: { compiled_function_node cfn = (compiled_function_node)fn; if (cfn.polymorphic_state != SemanticTree.polymorphic_state.ps_static) { break; } return create_compiled_static_method_call(cfn, loc, exprs); } case semantic_node_type.compiled_constructor_node: { compiled_constructor_call ccc = new compiled_constructor_call((compiled_constructor_node)fn,loc); ccc.parameters.AddRange(exprs); return ccc; } case semantic_node_type.indefinite_definition_node: { indefinite_function_call ifc = new indefinite_function_call(fn, loc); ifc.parameters.AddRange(exprs); return ifc; } default: throw new CompilerInternalError("Unknown function type"); } throw new CanNotReferenceToNonStaticMethodWithType(fn.name, loc); }
private function_node is_exist_eq_return_value_method(function_node fn, function_node_list funcs) { fn = find_eq_return_value_method_in_list(fn, funcs); return fn; /*if (fn == null) { return false; } return true;*/ }
public static function_intersection_node get_function_intersection(function_node left, function_node right) { return left.get_intersecion(right); }
//\ssyy //ssyy public void generate_inherited_from_base_and_interface_function(common_type_node ctype, function_node func) { common_method_node gen_func = context.create_function(func.name, null) as common_method_node; gen_func.polymorphic_state = SemanticTree.polymorphic_state.ps_common; gen_func.newslot_awaited = true; gen_func.is_final = true; gen_func.is_overload = true; gen_func.field_access_level = SemanticTree.field_access_level.fal_public; gen_func.return_value_type = func.return_value_type; //gen_func.return_variable = func.retu foreach (parameter par in func.parameters) { concrete_parameter_type cpt = (par.parameter_type == SemanticTree.parameter_type.value) ? concrete_parameter_type.cpt_const : concrete_parameter_type.cpt_var; common_parameter c_p = new common_parameter(par.name, par.parameter_type, gen_func, cpt, null); c_p.type = par.type; c_p.set_param_is_params(par.is_params); c_p.inital_value = par.inital_value; gen_func.parameters.AddElement(c_p); } local_variable lv = new local_variable(compiler_string_consts.self_word, gen_func.cont_type, gen_func, null); gen_func.scope.AddSymbol(compiler_string_consts.self_word, new SymbolInfo(lv)); gen_func.self_variable = lv; base_function_call bfc; this_node tn = null; common_method_node commn = func as common_method_node; if (commn != null) { tn = new this_node(commn.comperehensive_type as type_node, null); bfc = new common_method_call(commn, tn, null); } else { compiled_function_node compn = func as compiled_function_node; tn = new this_node(compn.comperehensive_type as type_node, null); bfc = new compiled_function_call(compn, tn, null); } foreach (parameter p in gen_func.parameters) { bfc.parameters.AddElement( create_variable_reference(p, null)); } //Это запретит чистку стека bfc.last_result_function_call = true; statements_list snlist = new statements_list(null); snlist.statements.AddElement(bfc); snlist.statements.AddElement(new empty_statement(null)); gen_func.function_code = snlist; context.pop_top_function(); //context.leave_block(); }
public static function_compare compare_functions(function_node left,function_node right) { function_intersection_node func_int_left = left.get_intersecion(right); function_intersection_node func_int_right = right.get_intersecion(left); if ((func_int_left == null) && (func_int_right == null)) { return function_compare.non_comparable; } if ((func_int_left != null) && (func_int_right == null)) { return func_int_left.function_relation; } if ((func_int_left == null) && (func_int_right != null)) { if (func_int_right.function_relation == function_compare.non_comparable) { return function_compare.non_comparable; } if (func_int_right.function_relation == function_compare.greater) { return function_compare.less; } if (func_int_right.function_relation == function_compare.less) { return function_compare.greater; } } if ((func_int_left != null) && (func_int_right != null)) { if ((func_int_left.function_relation == function_compare.less) && (func_int_right.function_relation == function_compare.greater)) { return function_compare.less; } if ((func_int_left.function_relation == function_compare.greater) && (func_int_right.function_relation == function_compare.less)) { return function_compare.greater; } throw new TreeConverter.CompilerInternalError("Contradiction in function relations"); } throw new TreeConverter.CompilerInternalError("Error in function relations"); }
private base_function_call create_static_method_call_with_params(function_node fn, location loc, type_node tn, bool procedure_allowed, expressions_list parametrs) { base_function_call bfc = create_static_method_call(fn, loc, tn, procedure_allowed); bfc.parameters.AddRange(parametrs); return bfc; }
private void add_intersection(function_node _func,function_intersection_node _func_intersec) { _func_intersections.Add(_func, _func_intersec); }
private base_function_call create_static_method_call(function_node fn, location loc, type_node tn, bool procedure_allowed) { if ((!procedure_allowed) && (fn.return_value_type == null)) { AddError(loc, "FUNCTION_EXPECTED_PROCEDURE_{0}_MEET", fn.name); } if (fn.semantic_node_type == semantic_node_type.common_method_node) { common_method_node cmn = (common_method_node)fn; if (cmn.polymorphic_state != SemanticTree.polymorphic_state.ps_static) { //ssyy изменил if (!cmn.is_constructor) { AddError(new CanNotCallNonStaticMethodWithClass(tn, loc, fn)); } if (cmn.cont_type.IsAbstract) ErrorsList.Add(new SimpleSemanticError(loc, "ABSTRACT_CONSTRUCTOR_{0}_CALL", cmn.name)); common_constructor_call csmc2 = new common_constructor_call(cmn, loc); return csmc2; //if (cmn.pascal_associated_constructor==null) //{ // throw new CanNotCallNonStaticMethodWithClass(tn,loc,fn); //} //common_constructor_call csmc2=new common_constructor_call(cmn.pascal_associated_constructor,loc); //return csmc2; //\ssyy } common_static_method_call csmc = new common_static_method_call(cmn, loc); return csmc; } if (fn.semantic_node_type == semantic_node_type.compiled_function_node) { compiled_function_node cfn = (compiled_function_node)fn; if (cfn.polymorphic_state != SemanticTree.polymorphic_state.ps_static) { AddError(new CanNotCallNonStaticMethodWithClass(tn, loc, fn)); } compiled_static_method_call csmc2 = new compiled_static_method_call(cfn, loc); return csmc2; } if (fn.semantic_node_type == semantic_node_type.compiled_constructor_node) { compiled_constructor_node ccn = (compiled_constructor_node)fn; compiled_constructor_call ccc = new compiled_constructor_call(ccn, loc); return ccc; } if (fn.semantic_node_type == semantic_node_type.basic_function_node) { return new basic_function_call(fn as basic_function_node, loc); } if (fn.semantic_node_type == semantic_node_type.common_namespace_function_node && (fn as common_namespace_function_node).ConnectedToType != null) { return new common_namespace_function_call(fn as common_namespace_function_node,loc); } if (fn.semantic_node_type == semantic_node_type.indefinite_definition_node) { return new indefinite_function_call(fn, loc); } throw new CompilerInternalError("Invalid method kind"); }
/* private static expression_node runtime_inc_int(location call_location, expression_node[] exprs) { if (exprs.Length != 1) { return null; } int_const_node icn = exprs[0] as int_const_node; if (icn == null) { return null; } return (new int_const_node(icn.constant_value + 1, call_location)); } private static expression_node runtime_dec_int(location call_location, expression_node[] exprs) { if (exprs.Length != 1) { return null; } int_const_node icn = exprs[0] as int_const_node; if (icn == null) { return null; } return (new int_const_node(icn.constant_value - 1, call_location)); } private static void mark_int_as_ordinal() { basic_function_node internal_inc_value = create_oti_method(SemanticTree.basic_function_type.iinc, _integer_type); internal_inc_value.compile_time_executor = runtime_inc_int; basic_function_node internal_dec_value = create_oti_method(SemanticTree.basic_function_type.idec, _integer_type); internal_dec_value.compile_time_executor = runtime_dec_int; basic_function_node inc_value_method = create_inc_value_method(SemanticTree.basic_function_type.iinc, _integer_type); basic_function_node dec_value_method = create_dec_value_method(SemanticTree.basic_function_type.idec, _integer_type); basic_function_node inc_method = create_inc_method(SemanticTree.basic_function_type.iinc, _integer_type); basic_function_node dec_method = create_dec_method(SemanticTree.basic_function_type.idec, _integer_type); //basic_function_node inc_method = create_oti_method(SemanticTree.basic_function_type.iinc, _integer_type); //basic_function_node dec_method = create_oti_method(SemanticTree.basic_function_type.idec, _integer_type); SymbolInfo si = _integer_type.find_in_type(compiler_string_consts.greq_name); basic_function_node greq = (basic_function_node)si.sym_info; si = _integer_type.find(compiler_string_consts.smeq_name); basic_function_node loeq = (basic_function_node)si.sym_info; //DarkStar Changed MinValue->MaxValue constant_node cn_max = new int_const_node(int.MaxValue,null); constant_node cn_min = new int_const_node(int.MinValue,null); basic_function_node i2i_method = create_emty_function(integer_type); ordinal_type_to_int ordinal_type_to_int = int_to_int; ordinal_type_interface oti = new ordinal_type_interface(inc_method,dec_method,inc_value_method,dec_value_method, internal_inc_value,internal_dec_value,loeq,greq,cn_min,cn_max,i2i_method,ordinal_type_to_int); _integer_type.add_internal_interface(oti); } private static expression_node runtime_inc_char(location call_location, expression_node[] exprs) { if (exprs.Length != 1) { return null; } char_const_node icn = exprs[0] as char_const_node; if (icn == null) { return null; } return (new int_const_node((icn.constant_value+1) , call_location)); } private static expression_node runtime_dec_char(location call_location, expression_node[] exprs) { if (exprs.Length != 1) { return null; } char_const_node icn = exprs[0] as char_const_node; if (icn == null) { return null; } return (new int_const_node((icn.constant_value-1), call_location)); } private static void mark_char_as_ordinal() { basic_function_node internal_inc_value = create_oti_method(SemanticTree.basic_function_type.cinc, _integer_type); internal_inc_value.compile_time_executor = runtime_inc_char; basic_function_node internal_dec_value = create_oti_method(SemanticTree.basic_function_type.cdec, _integer_type); internal_dec_value.compile_time_executor = runtime_dec_char; basic_function_node inc_value_method = create_inc_value_method(SemanticTree.basic_function_type.iinc, _integer_type); basic_function_node dec_value_method = create_dec_value_method(SemanticTree.basic_function_type.idec, _integer_type); basic_function_node inc_method = create_inc_method(SemanticTree.basic_function_type.iinc, _integer_type); basic_function_node dec_method = create_dec_method(SemanticTree.basic_function_type.iinc, _integer_type); SymbolInfo si = _char_type.find(compiler_string_consts.greq_name); basic_function_node greq = (basic_function_node)si.sym_info; si = _char_type.find(compiler_string_consts.smeq_name); basic_function_node loeq = (basic_function_node)si.sym_info; constant_node cn_max = new char_const_node(char.MaxValue,null); constant_node cn_min = new char_const_node(char.MinValue,null); basic_function_node c2i_method = new basic_function_node(SemanticTree.basic_function_type.chartoi, _integer_type,true); basic_parameter cp = new basic_parameter(compiler_string_consts.unary_param_name, _char_type, SemanticTree.parameter_type.value, c2i_method); //TODO: Сделано очень плохо. add_stand_type(SemanticTree.basic_function_type.chartoi, c2i_method); c2i_method.parameters.AddElement(cp); c2i_method.compile_time_executor = char_to_int; ordinal_type_to_int ordinal_type_to_int = char_to_int; ordinal_type_interface oti = new ordinal_type_interface(inc_method,dec_method,inc_value_method,dec_value_method, internal_inc_value,internal_dec_value,loeq,greq,cn_min,cn_max, c2i_method,ordinal_type_to_int); _char_type.add_internal_interface(oti); } */ private static void make_function_comparison(function_node left, function_node right, function_compare comp) { function_intersection_node fin = new function_intersection_node(left, right); fin.function_relation = comp; function_node.add_function_intersection(left,right,fin); }
private base_function_call create_not_static_method_call(function_node fn, expression_node en, location loc, bool procedure_allowed) { try_convert_typed_expression_to_function_call(ref en); if ((!procedure_allowed) && (fn.return_value_type == null)) { AddError(loc, "FUNCTION_EXPECTED_PROCEDURE_{0}_MEET", fn); } if (fn.semantic_node_type == semantic_node_type.common_method_node) { common_method_node cmn = (common_method_node)fn; if (cmn.is_constructor) { AddError(loc, "CAN_NOT_CALL_CONSTRUCTOR_AS_PROCEDURE"); } if (cmn.original_function != null && cmn.original_function is compiled_function_node && (cmn.original_function as compiled_function_node).ConnectedToType != null) { common_static_method_call csmc = new common_static_method_call(cmn, loc); return csmc; } if (cmn.polymorphic_state == SemanticTree.polymorphic_state.ps_static) { AddError(new CanNotCallStaticMethodWithExpression(en, fn)); } common_method_call cmc = new common_method_call(cmn, en, loc); cmc.virtual_call = !inherited_ident_processing; return cmc; } if (fn.semantic_node_type == semantic_node_type.compiled_function_node) { compiled_function_node cfn = (compiled_function_node)fn; if (cfn.ConnectedToType != null) { compiled_static_method_call csmc = new compiled_static_method_call(cfn, loc); return csmc; } else { if (cfn.polymorphic_state == SemanticTree.polymorphic_state.ps_static) { if (!cfn.is_extension_method) AddError(new CanNotCallStaticMethodWithExpression(en, fn)); else return new compiled_static_method_call(cfn, loc); } compiled_function_call cfc = new compiled_function_call(cfn, en, loc); cfc.virtual_call = !inherited_ident_processing; return cfc; } } if (fn.semantic_node_type == semantic_node_type.compiled_constructor_node) { AddError(loc, "CAN_NOT_CALL_CONSTRUCTOR_AS_PROCEDURE"); } if (fn.semantic_node_type == semantic_node_type.common_namespace_function_node && (fn as common_namespace_function_node).ConnectedToType != null) { common_namespace_function_call cnfc = new common_namespace_function_call(fn as common_namespace_function_node,loc); //cnfc.parameters.AddElement(en); return cnfc; } if (fn.semantic_node_type == semantic_node_type.indefinite_definition_node) { indefinite_function_call ifc = new indefinite_function_call(fn, loc); return ifc; } throw new CompilerInternalError("Invalid method kind"); }
private static void add_std_convertions() { type_intersection_node inter = new type_intersection_node(type_compare.greater_type); Type t = typeof(char); Type[] types = new Type[1]; types[0] = typeof(char); System.Reflection.MethodInfo mi = t.GetMethod(compiler_string_consts.to_string_method_name, types); compiled_function_node cfn = compiled_function_node.get_compiled_method(mi); inter.another_to_this = new type_conversion(cfn); _string_type.add_intersection_node(_char_type, inter,false); _char_to_string = cfn; }
public void Add(function_node function) { if (_functions == null) { _functions = new List<function_node>(); } _functions.Add(function); UpdateReturnType(); }
/* private static void mark_byte_as_ordinal() { basic_function_node inc_value_method = create_inc_value_method(SemanticTree.basic_function_type.binc, _byte_type); basic_function_node dec_value_method = create_dec_value_method(SemanticTree.basic_function_type.bdec, _byte_type); basic_function_node inc_method = create_inc_method(SemanticTree.basic_function_type.binc, _byte_type); basic_function_node dec_method = create_dec_method(SemanticTree.basic_function_type.bdec, _byte_type); SymbolInfo si = _byte_type.find_in_type(compiler_string_consts.greq_name); basic_function_node greq = (basic_function_node)si.sym_info; si = _byte_type.find(compiler_string_consts.smeq_name); basic_function_node loeq = (basic_function_node)si.sym_info; constant_node cn_max = new byte_const_node(byte.MaxValue, null); constant_node cn_min = new byte_const_node(byte.MinValue, null); basic_function_node i2i_method = create_emty_function(byte_type); ordinal_type_to_int ordinal_type_to_int = byte_to_int; ordinal_type_interface oti = new ordinal_type_interface(inc_method, dec_method, inc_value_method, dec_value_method, internal_inc_value, internal_dec_value, loeq, greq, cn_min, cn_max, i2i_method, ordinal_type_to_int); _byte_type.add_internal_interface(oti); } */ private static void mark_type_as_ordinal(type_node type, SemanticTree.basic_function_type inc,SemanticTree.basic_function_type dec, SemanticTree.basic_function_type vinc, SemanticTree.basic_function_type vdec, constant_node lower_value, constant_node upper_value, function_node t2i,ordinal_type_to_int t2i_comp) { basic_function_node inc_value = create_oti_method(inc, type, SemanticTree.parameter_type.value); basic_function_node dec_value = create_oti_method(dec, type, SemanticTree.parameter_type.value); basic_function_node inc_var = create_oti_method(vinc, type, SemanticTree.parameter_type.var); basic_function_node dec_var = create_oti_method(vdec, type, SemanticTree.parameter_type.var); SymbolInfo si = type.find_in_type(compiler_string_consts.greq_name); basic_function_node greq = (basic_function_node)si.sym_info; si = type.find(compiler_string_consts.smeq_name); basic_function_node loeq = (basic_function_node)si.sym_info; si = type.find(compiler_string_consts.sm_name); basic_function_node lo = (basic_function_node)si.sym_info; si = type.find(compiler_string_consts.gr_name); basic_function_node gr = (basic_function_node)si.sym_info; ordinal_type_interface oti = new ordinal_type_interface(inc_value, dec_value, inc_var, dec_var, loeq, greq, lo, gr, lower_value, upper_value, t2i, t2i_comp); type.add_internal_interface(oti); }
public indefinite_function_call(function_node fn, location loc) : base(fn.return_value_type, loc) { _function_node = fn; }
private void WriteMethodReference(function_node fn) { if (fn is common_method_node) { bw.Write((byte)0); WriteMethodReference(fn as common_method_node); } else if (fn is compiled_constructor_node) { bw.Write((byte)1); bw.Write(GetCompiledConstructor(fn as compiled_constructor_node)); } else if (fn is compiled_function_node) { bw.Write((byte)2); bw.Write(GetCompiledMethod(fn as compiled_function_node)); } }
public static void add_function_intersection(function_node left, function_node right, function_intersection_node intersec) { #if DEBUG function_intersection_node func_int_left = left.get_intersecion(right); if (func_int_left != null) { throw new TreeConverter.CompilerInternalError("Duplicate function intersection"); } #endif left.add_intersection(right, intersec); }
//сообщаем функции смещение, по которому расположен ее код private void FixupCode(function_node fn) { int tmp = (int)bw.BaseStream.Position; int pos = func_codes[fn]; bw.Seek(pos,SeekOrigin.Begin); bw.Write(tmp); bw.Seek(tmp,SeekOrigin.Begin); }
public function_node find_eq_method_in_list(function_node fn,function_node_list funcs) { foreach(function_node f in funcs) { //Проверка добавлена 14.07.2006 в 14.28. Нужно с ней прогнать тесты, хотя вроде вреда от нее не должно быть. if (f==fn) { return f; } if (function_eq_params(fn,f)) { if (fn.original_function == f.original_function) { return f; } } } return null; }