mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-14 09:09:21 +02:00
fcl-passrc: fixed helper in other unit
This commit is contained in:
parent
f3f2341c8a
commit
4e2606fcbe
@ -16959,7 +16959,7 @@ begin
|
||||
begin
|
||||
Entry:=FActiveHelpers[i];
|
||||
HelperForType:=Entry.HelperForType;
|
||||
if HelperForType=TypeEl then
|
||||
if IsSameType(HelperForType,TypeEl,prraNone) then
|
||||
begin
|
||||
// add Helper and its ancestors
|
||||
HelperScope:=TPasClassScope(Entry.Helper.CustomData);
|
||||
|
@ -929,6 +929,7 @@ type
|
||||
Procedure TestTypeHelper_Set;
|
||||
Procedure TestTypeHelper_Enumerator;
|
||||
Procedure TestTypeHelper_String;
|
||||
Procedure TestTypeHelper_StringOtherUnit;
|
||||
Procedure TestTypeHelper_Boolean;
|
||||
Procedure TestTypeHelper_Double;
|
||||
Procedure TestTypeHelper_DoubleAlias;
|
||||
@ -17421,6 +17422,43 @@ begin
|
||||
ParseProgram;
|
||||
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;
|
||||
begin
|
||||
StartProgram(false);
|
||||
|
Loading…
Reference in New Issue
Block a user