mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-09-16 13:19:04 +02:00
fcl-passrc: fixed helper in other unit
This commit is contained in:
parent
f3f2341c8a
commit
4e2606fcbe
@ -16959,7 +16959,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
Entry:=FActiveHelpers[i];
|
Entry:=FActiveHelpers[i];
|
||||||
HelperForType:=Entry.HelperForType;
|
HelperForType:=Entry.HelperForType;
|
||||||
if HelperForType=TypeEl then
|
if IsSameType(HelperForType,TypeEl,prraNone) then
|
||||||
begin
|
begin
|
||||||
// add Helper and its ancestors
|
// add Helper and its ancestors
|
||||||
HelperScope:=TPasClassScope(Entry.Helper.CustomData);
|
HelperScope:=TPasClassScope(Entry.Helper.CustomData);
|
||||||
|
@ -929,6 +929,7 @@ type
|
|||||||
Procedure TestTypeHelper_Set;
|
Procedure TestTypeHelper_Set;
|
||||||
Procedure TestTypeHelper_Enumerator;
|
Procedure TestTypeHelper_Enumerator;
|
||||||
Procedure TestTypeHelper_String;
|
Procedure TestTypeHelper_String;
|
||||||
|
Procedure TestTypeHelper_StringOtherUnit;
|
||||||
Procedure TestTypeHelper_Boolean;
|
Procedure TestTypeHelper_Boolean;
|
||||||
Procedure TestTypeHelper_Double;
|
Procedure TestTypeHelper_Double;
|
||||||
Procedure TestTypeHelper_DoubleAlias;
|
Procedure TestTypeHelper_DoubleAlias;
|
||||||
@ -17421,6 +17422,43 @@ begin
|
|||||||
ParseProgram;
|
ParseProgram;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TTestResolver.TestTypeHelper_StringOtherUnit;
|
||||||
|
begin
|
||||||
|
AddModuleWithIntfImplSrc('unit2.pas',
|
||||||
|
LinesToStr([
|
||||||
|
'{$modeswitch typehelpers}',
|
||||||
|
'type',
|
||||||
|
' TStringHelper = type helper for String',
|
||||||
|
' procedure DoIt;',
|
||||||
|
' end;',
|
||||||
|
' TCharHelper = type helper for char',
|
||||||
|
' procedure Fly;',
|
||||||
|
' end;',
|
||||||
|
'']),
|
||||||
|
LinesToStr([
|
||||||
|
'procedure TStringHelper.DoIt;',
|
||||||
|
'begin',
|
||||||
|
' Self[1]:=Self[2];',
|
||||||
|
'end;',
|
||||||
|
'procedure TCharHelper.Fly;',
|
||||||
|
'begin',
|
||||||
|
' Self:=''c'';',
|
||||||
|
' Self:=Self;',
|
||||||
|
'end;',
|
||||||
|
'']));
|
||||||
|
StartProgram(true);
|
||||||
|
Add([
|
||||||
|
'uses unit2;',
|
||||||
|
'var s: string;',
|
||||||
|
'begin',
|
||||||
|
' ''abc''.DoIt;',
|
||||||
|
' ''xyz''.DoIt();',
|
||||||
|
' ''c''.Fly;',
|
||||||
|
' s.DoIt;',
|
||||||
|
'']);
|
||||||
|
ParseProgram;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TTestResolver.TestTypeHelper_Boolean;
|
procedure TTestResolver.TestTypeHelper_Boolean;
|
||||||
begin
|
begin
|
||||||
StartProgram(false);
|
StartProgram(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user