mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-05 11:06:13 +02:00
* fixed assigning ansi/unicodestrings to shortstrings on the JVM target
(and cleaned up implementing support for special x_to_shortstring assignments in the process) git-svn-id: branches/jvmbackend@18877 -
This commit is contained in:
parent
9fb06fcb8f
commit
7117264f96
@ -42,6 +42,9 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
tjvmassignmentnode = class(tcgassignmentnode)
|
tjvmassignmentnode = class(tcgassignmentnode)
|
||||||
|
protected
|
||||||
|
function direct_shortstring_assignment: boolean; override;
|
||||||
|
public
|
||||||
function pass_1: tnode; override;
|
function pass_1: tnode; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -65,6 +68,14 @@ uses
|
|||||||
|
|
||||||
{ tjvmassignmentnode }
|
{ tjvmassignmentnode }
|
||||||
|
|
||||||
|
function tjvmassignmentnode.direct_shortstring_assignment: boolean;
|
||||||
|
begin
|
||||||
|
if maybe_find_real_class_definition(right.resultdef,false)=java_jlstring then
|
||||||
|
inserttypeconv_explicit(right,cunicodestringtype);
|
||||||
|
result:=right.resultdef.typ=stringdef;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tjvmassignmentnode.pass_1: tnode;
|
function tjvmassignmentnode.pass_1: tnode;
|
||||||
var
|
var
|
||||||
block: tblocknode;
|
block: tblocknode;
|
||||||
|
@ -67,6 +67,9 @@ interface
|
|||||||
tassigntype = (at_normal,at_plus,at_minus,at_star,at_slash);
|
tassigntype = (at_normal,at_plus,at_minus,at_star,at_slash);
|
||||||
|
|
||||||
tassignmentnode = class(tbinarynode)
|
tassignmentnode = class(tbinarynode)
|
||||||
|
protected
|
||||||
|
function direct_shortstring_assignment: boolean; virtual;
|
||||||
|
public
|
||||||
assigntype : tassigntype;
|
assigntype : tassigntype;
|
||||||
constructor create(l,r : tnode);virtual;
|
constructor create(l,r : tnode);virtual;
|
||||||
{ no checks for validity of assignment }
|
{ no checks for validity of assignment }
|
||||||
@ -474,6 +477,14 @@ implementation
|
|||||||
TASSIGNMENTNODE
|
TASSIGNMENTNODE
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
|
function tassignmentnode.direct_shortstring_assignment: boolean;
|
||||||
|
begin
|
||||||
|
result:=
|
||||||
|
is_char(right.resultdef) or
|
||||||
|
(right.resultdef.typ=stringdef);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
constructor tassignmentnode.create(l,r : tnode);
|
constructor tassignmentnode.create(l,r : tnode);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -603,9 +614,7 @@ implementation
|
|||||||
{ insert typeconv, except for chars that are handled in
|
{ insert typeconv, except for chars that are handled in
|
||||||
secondpass and except for ansi/wide string that can
|
secondpass and except for ansi/wide string that can
|
||||||
be converted immediatly }
|
be converted immediatly }
|
||||||
if (not is_char(right.resultdef) or
|
if not direct_shortstring_assignment then
|
||||||
(target_info.system in systems_managed_vm)) and
|
|
||||||
(right.resultdef.typ<>stringdef) then
|
|
||||||
inserttypeconv(right,left.resultdef);
|
inserttypeconv(right,left.resultdef);
|
||||||
if right.resultdef.typ=stringdef then
|
if right.resultdef.typ=stringdef then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user