Forráskód Böngészése

* handle tc_equal typeconversions from conststring to a stringdef in
simplify, so that shortstring -> shortstring constant string conversions
are simplified for LLVM too (it leaves regular tc_equal type conversions
because often the type is still somewhat different), which is required
for the code in tasmlisttypedconstbuilder.tc_emit_stringdef() (it
assumes the result of inserting a type conversion is again a
stringconstant if it can be handled at compile time)

git-svn-id: trunk@32907 -

Jonas Maebe 9 éve
szülő
commit
bbe8e346e0
1 módosított fájl, 10 hozzáadás és 7 törlés
  1. 10 7
      compiler/ncnv.pas

+ 10 - 7
compiler/ncnv.pas

@@ -2654,14 +2654,17 @@ implementation
           remove the typeconv node }
         case left.nodetype of
           stringconstn :
-            if (convtype=tc_string_2_string) and
-               (resultdef.typ=stringdef) and
-              (
-                ((not is_widechararray(left.resultdef) and
-                  not is_wide_or_unicode_string(left.resultdef)) or
-                 (tstringdef(resultdef).stringtype in [st_widestring,st_unicodestring,st_ansistring])
+            if (resultdef.typ=stringdef) and
+               ((convtype=tc_equal) or
+                ((convtype=tc_string_2_string) and
+                 (
+                  ((not is_widechararray(left.resultdef) and
+                    not is_wide_or_unicode_string(left.resultdef)) or
+                   (tstringdef(resultdef).stringtype in [st_widestring,st_unicodestring,st_ansistring])
+                  )
+                 )
                 )
-              ) then
+               ) then
               begin
                 { output string consts in local ansistring encoding }
                 if is_ansistring(resultdef) and ((tstringdef(resultdef).encoding=0)or(tstringdef(resultdef).encoding=globals.CP_NONE)) then