mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 07:19:35 +02:00
pastojs: library: export var
This commit is contained in:
parent
f4580ff612
commit
d2a091ef85
@ -4915,6 +4915,7 @@ var
|
||||
ResolvedEl: TPasResolverResult;
|
||||
DeclEl: TPasElement;
|
||||
Proc: TPasProcedure;
|
||||
V: TPasVariable;
|
||||
begin
|
||||
if El.Parent is TLibrarySection then
|
||||
// ok
|
||||
@ -4930,14 +4931,22 @@ begin
|
||||
DeclEl:=ResolvedEl.IdentEl;
|
||||
if DeclEl=nil then
|
||||
RaiseMsg(20210106223620,nSymbolCannotBeExportedFromALibrary,
|
||||
sSymbolCannotBeExportedFromALibrary,[],El)
|
||||
else if DeclEl is TPasProcedure then
|
||||
sSymbolCannotBeExportedFromALibrary,[],El);
|
||||
if not (DeclEl.Parent is TPasSection) then
|
||||
RaiseMsg(20210106224436,nSymbolCannotBeExportedFromALibrary,
|
||||
sSymbolCannotBeExportedFromALibrary,[],El);
|
||||
if DeclEl is TPasProcedure then
|
||||
begin
|
||||
Proc:=TPasProcedure(DeclEl);
|
||||
if Proc.Parent is TPasSection then
|
||||
// ok
|
||||
else
|
||||
RaiseMsg(20210106224436,nSymbolCannotBeExportedFromALibrary,
|
||||
if Proc.IsExternal or Proc.IsAbstract then
|
||||
RaiseMsg(20211021225630,nSymbolCannotBeExportedFromALibrary,
|
||||
sSymbolCannotBeExportedFromALibrary,[],El);
|
||||
end
|
||||
else if DeclEl is TPasVariable then
|
||||
begin
|
||||
V:=TPasVariable(DeclEl);
|
||||
if vmExternal in V.VarModifiers then
|
||||
RaiseMsg(20211021225634,nSymbolCannotBeExportedFromALibrary,
|
||||
sSymbolCannotBeExportedFromALibrary,[],El);
|
||||
end
|
||||
else
|
||||
|
@ -913,6 +913,7 @@ type
|
||||
Procedure TestLibrary_ExportFunc;
|
||||
Procedure TestLibrary_Export_Index_Fail;
|
||||
Procedure TestLibrary_ExportVar; // ToDo
|
||||
Procedure TestLibrary_ExportUnitFunc;
|
||||
// ToDo: test delayed specialization init
|
||||
// ToDo: analyzer
|
||||
end;
|
||||
@ -33836,8 +33837,6 @@ end;
|
||||
|
||||
procedure TTestModule.TestLibrary_ExportVar;
|
||||
begin
|
||||
exit;
|
||||
|
||||
StartLibrary(false);
|
||||
Add([
|
||||
'var Wing: word;',
|
||||
@ -33855,6 +33854,11 @@ begin
|
||||
CheckResolverUnexpectedHints();
|
||||
end;
|
||||
|
||||
procedure TTestModule.TestLibrary_ExportUnitFunc;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
Initialization
|
||||
RegisterTests([TTestModule]);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user