mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 23:21:57 +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;
|
||||
|
||||
tjvmassignmentnode = class(tcgassignmentnode)
|
||||
protected
|
||||
function direct_shortstring_assignment: boolean; override;
|
||||
public
|
||||
function pass_1: tnode; override;
|
||||
end;
|
||||
|
||||
@ -65,6 +68,14 @@ uses
|
||||
|
||||
{ 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;
|
||||
var
|
||||
block: tblocknode;
|
||||
|
@ -67,6 +67,9 @@ interface
|
||||
tassigntype = (at_normal,at_plus,at_minus,at_star,at_slash);
|
||||
|
||||
tassignmentnode = class(tbinarynode)
|
||||
protected
|
||||
function direct_shortstring_assignment: boolean; virtual;
|
||||
public
|
||||
assigntype : tassigntype;
|
||||
constructor create(l,r : tnode);virtual;
|
||||
{ no checks for validity of assignment }
|
||||
@ -474,6 +477,14 @@ implementation
|
||||
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);
|
||||
|
||||
begin
|
||||
@ -603,9 +614,7 @@ implementation
|
||||
{ insert typeconv, except for chars that are handled in
|
||||
secondpass and except for ansi/wide string that can
|
||||
be converted immediatly }
|
||||
if (not is_char(right.resultdef) or
|
||||
(target_info.system in systems_managed_vm)) and
|
||||
(right.resultdef.typ<>stringdef) then
|
||||
if not direct_shortstring_assignment then
|
||||
inserttypeconv(right,left.resultdef);
|
||||
if right.resultdef.typ=stringdef then
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user