fix #1580
This commit is contained in:
parent
b28790ed1d
commit
45c042032a
|
|
@ -9008,6 +9008,8 @@ namespace PascalABCCompiler.NETGenerator
|
|||
case basic_function_type.booltoui: il.Emit(OpCodes.Conv_U4); break;
|
||||
case basic_function_type.booltol: il.Emit(OpCodes.Conv_I8); break;
|
||||
case basic_function_type.booltoul: il.Emit(OpCodes.Conv_U8); break;
|
||||
case basic_function_type.ltop: il.Emit(OpCodes.Conv_I); break;
|
||||
case basic_function_type.ptol: il.Emit(OpCodes.Conv_I8); break;
|
||||
|
||||
case basic_function_type.objtoobj:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ namespace PascalABCCompiler.SemanticTree
|
|||
objassign,objeq,objnoteq, //присваивание и эквивалентность объектов по ссылке.
|
||||
//write,writei,writed,writec,writeb,read,readi,readd,readc,readb,expd,absd,absi //temporary functions (Нужны только на начальном этапе отладки. Потом обязательно удалить.)
|
||||
objtoobj, boolinc, booldec, boolsinc, boolsdec, booltoi, enumgr, enumgreq, enumsm, enumsmeq,
|
||||
booltob, booltosb, booltos, booltous, booltoui, booltol, booltoul
|
||||
booltob, booltosb, booltos, booltous, booltoui, booltol, booltoul,
|
||||
ltop, ptol
|
||||
};
|
||||
|
||||
public enum runtime_statement_type { invoke_delegate, ctor_delegate, begin_invoke_delegate, end_invoke_delegate };
|
||||
|
|
|
|||
15
TestSuite/pointers10.pas
Normal file
15
TestSuite/pointers10.pas
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
begin
|
||||
var i: int64 := $FF22FF3322;
|
||||
var p := pointer(i);
|
||||
i := int64(p);
|
||||
if System.Environment.Is64BitProcess then
|
||||
begin
|
||||
assert(i = $FF22FF3322);
|
||||
assert(PointerToString(p) = '$FF22FF3322');
|
||||
end;
|
||||
i := $FF22FF;
|
||||
p := pointer(i);
|
||||
i := int64(p);
|
||||
assert(i = $FF22FF);
|
||||
assert(PointerToString(p) = '$FF22FF');
|
||||
end.
|
||||
|
|
@ -493,6 +493,9 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
|
||||
private static basic_function_node _obj_to_obj;
|
||||
|
||||
private static basic_function_node _int64_to_pointer;
|
||||
private static basic_function_node _pointer_to_int64;
|
||||
|
||||
private static compiled_function_node _resize_func;
|
||||
|
||||
private static System.StringComparer _string_comparer = StringComparer.Ordinal;
|
||||
|
|
@ -2057,6 +2060,8 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
|
||||
_exception_base_type = compiled_type_node.get_type_node(typeof(System.Exception), symtab);
|
||||
_exception_base_type.SetName(compiler_string_consts.base_exception_class_name);
|
||||
_int64_to_pointer = make_type_conversion(_int64_type, _pointer_type, type_compare.greater_type, SemanticTree.basic_function_type.ltop, false);
|
||||
_pointer_to_int64 = make_type_conversion(_pointer_type, _int64_type, type_compare.less_type, SemanticTree.basic_function_type.ptol, false);
|
||||
}
|
||||
|
||||
private static List<type_node> wait_add_ref_list = new List<type_node>();
|
||||
|
|
@ -5156,6 +5161,22 @@ namespace PascalABCCompiler.SystemLibrary
|
|||
}
|
||||
}
|
||||
|
||||
public static basic_function_node int64_to_pointer
|
||||
{
|
||||
get
|
||||
{
|
||||
return _int64_to_pointer;
|
||||
}
|
||||
}
|
||||
|
||||
public static basic_function_node pointer_to_int64
|
||||
{
|
||||
get
|
||||
{
|
||||
return _pointer_to_int64;
|
||||
}
|
||||
}
|
||||
|
||||
public static compiled_type_node icloneable_interface
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -3714,13 +3714,29 @@ namespace PascalABCCompiler.TreeRealization
|
|||
if (_explicit_convertions_from.TryGetValue(ctn, out fn))
|
||||
return fn;
|
||||
if (SemanticRules.PoinerRealization == PoinerRealization.VoidStar)
|
||||
{
|
||||
if ((this == SystemLibrary.SystemLibrary.integer_type && ctn == SystemLibrary.SystemLibrary.pointer_type) ||
|
||||
(this == SystemLibrary.SystemLibrary.pointer_type && ctn == SystemLibrary.SystemLibrary.integer_type))
|
||||
(this == SystemLibrary.SystemLibrary.pointer_type && ctn == SystemLibrary.SystemLibrary.integer_type)
|
||||
)
|
||||
{
|
||||
fn = TreeConverter.convertion_data_and_alghoritms.get_empty_conversion(ctn, this, false);
|
||||
_explicit_convertions_from.Add(ctn, fn);
|
||||
return fn;
|
||||
}
|
||||
/*else if ((this == SystemLibrary.SystemLibrary.pointer_type && ctn == SystemLibrary.SystemLibrary.int64_type))
|
||||
{
|
||||
fn = SystemLibrary.SystemLibrary.int64_to_pointer;
|
||||
_explicit_convertions_from.Add(ctn, fn);
|
||||
return fn;
|
||||
}
|
||||
else if ((this == SystemLibrary.SystemLibrary.int64_type && ctn == SystemLibrary.SystemLibrary.pointer_type))
|
||||
{
|
||||
fn = SystemLibrary.SystemLibrary.pointer_to_int64;
|
||||
_explicit_convertions_from.Add(ctn, fn);
|
||||
return fn;
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
//enum->int32, int32->enum
|
||||
//TODO переделать это. Наверно это делается както нетак. Enum Conversion
|
||||
|
|
|
|||
|
|
@ -6877,7 +6877,10 @@ begin
|
|||
//result:= Convert.ToString(integer(p), 16);
|
||||
if p = nil then
|
||||
result := 'nil'
|
||||
else result := '$' + integer(p).ToString('X');
|
||||
else if Environment.Is64BitProcess then
|
||||
result := '$' + int64(p).ToString('X')
|
||||
else
|
||||
result := '$' + integer(p).ToString('X')
|
||||
end;
|
||||
|
||||
procedure Exec(filename: string);
|
||||
|
|
|
|||
Loading…
Reference in a new issue