mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-03 10:38:45 +02:00
pastojs: added libpas2js hook SetPas2JSUnitAliasCallBack
git-svn-id: trunk@43813 -
This commit is contained in:
parent
25c11a94c4
commit
366ee5e835
@ -379,6 +379,7 @@ type
|
||||
Procedure TestUnit_UnitNotFoundErrorPos;
|
||||
Procedure TestUnit_AccessIndirectUsedUnitFail;
|
||||
Procedure TestUnit_Intf1Impl2Intf1;
|
||||
Procedure TestUnit_Intf1Impl2Intf1_Duplicate;
|
||||
|
||||
// procs
|
||||
Procedure TestProcParam;
|
||||
@ -2386,8 +2387,13 @@ function TCustomTestResolver.OnPasResolverFindUnit(SrcResolver: TPasResolver;
|
||||
{$ENDIF}
|
||||
CurEngine:=FindModuleWithFilename(aFilename);
|
||||
if CurEngine=nil then exit(false);
|
||||
aModule:=InitUnit(CurEngine);
|
||||
if aModule=nil then exit(false);
|
||||
if CurEngine.Module=nil then
|
||||
begin
|
||||
aModule:=InitUnit(CurEngine);
|
||||
if aModule=nil then exit(false);
|
||||
end
|
||||
else
|
||||
aModule:=CurEngine.Module;
|
||||
OnPasResolverFindUnit:=aModule;
|
||||
Result:=true;
|
||||
end;
|
||||
@ -6091,6 +6097,27 @@ begin
|
||||
ParseUnit;
|
||||
end;
|
||||
|
||||
procedure TTestResolver.TestUnit_Intf1Impl2Intf1_Duplicate;
|
||||
begin
|
||||
AddModuleWithIntfImplSrc('unit1.pp',
|
||||
LinesToStr([
|
||||
'type number = longint;']),
|
||||
LinesToStr([
|
||||
'uses afile;',
|
||||
'procedure DoIt;',
|
||||
'begin',
|
||||
' i:=3;',
|
||||
'end;']));
|
||||
|
||||
StartUnit(true);
|
||||
Add([
|
||||
'interface',
|
||||
'uses unit1, foo in ''unit1.pp'';',
|
||||
'var i: number;',
|
||||
'implementation']);
|
||||
ParseUnit;
|
||||
end;
|
||||
|
||||
procedure TTestResolver.TestProcParam;
|
||||
begin
|
||||
StartProgram(false);
|
||||
|
@ -212,7 +212,7 @@ begin
|
||||
UnitNameMaxLen:=Max(UnitNameLen,255);
|
||||
s:=UseUnitName;
|
||||
SetLength(s,UnitNameMaxLen);
|
||||
if OnUnitAlias(OnUnitAliasData,Pointer(s),UnitNameLen,UnitNameMaxLen) then
|
||||
if OnUnitAlias(OnUnitAliasData,Pointer(s),UnitNameMaxLen) then
|
||||
UseUnitName:=LeftStr(s,UnitNameLen);
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user