mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 02:29:19 +02:00
* Allow System.Variants (Delphi-compatible name) to be found when inserting variants unit
This commit is contained in:
parent
a9cc89ff46
commit
9e228ff355
@ -211,23 +211,30 @@ implementation
|
|||||||
procedure maybeloadvariantsunit;
|
procedure maybeloadvariantsunit;
|
||||||
var
|
var
|
||||||
hp : tmodule;
|
hp : tmodule;
|
||||||
|
addsystemnamespace : Boolean;
|
||||||
begin
|
begin
|
||||||
{ Do we need the variants unit? Skip this
|
{ Do we need the variants unit? Skip this
|
||||||
for VarUtils unit for bootstrapping }
|
for VarUtils unit for bootstrapping }
|
||||||
if not(mf_uses_variants in current_module.moduleflags) or
|
if not(mf_uses_variants in current_module.moduleflags) or
|
||||||
(current_module.modulename^='VARUTILS') then
|
(current_module.modulename^='VARUTILS') or
|
||||||
|
(current_module.modulename^='SYSTEM.VARUTILS') then
|
||||||
exit;
|
exit;
|
||||||
{ Variants unit already loaded? }
|
{ Variants unit already loaded? }
|
||||||
hp:=tmodule(loaded_units.first);
|
hp:=tmodule(loaded_units.first);
|
||||||
while assigned(hp) do
|
while assigned(hp) do
|
||||||
begin
|
begin
|
||||||
if hp.modulename^='VARIANTS' then
|
if (hp.modulename^='VARIANTS') or (hp.modulename^='SYSTEM.VARIANTS') then
|
||||||
exit;
|
exit;
|
||||||
hp:=tmodule(hp.next);
|
hp:=tmodule(hp.next);
|
||||||
end;
|
end;
|
||||||
{ Variants unit is not loaded yet, load it now }
|
{ Variants unit is not loaded yet, load it now }
|
||||||
Message(parser_w_implicit_uses_of_variants_unit);
|
Message(parser_w_implicit_uses_of_variants_unit);
|
||||||
|
addsystemnamespace:=namespacelist.Find('System')=Nil;
|
||||||
|
if addsystemnamespace then
|
||||||
|
namespacelist.concat('System');
|
||||||
AddUnit('variants');
|
AddUnit('variants');
|
||||||
|
if addsystemnamespace then
|
||||||
|
namespacelist.Remove('System');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user