浏览代码

pastojs: library: forbid unit exports

mattias 4 年之前
父节点
当前提交
7997f884b7
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      packages/pastojs/src/fppas2js.pp

+ 6 - 0
packages/pastojs/src/fppas2js.pp

@@ -4935,6 +4935,12 @@ begin
   if not (DeclEl.Parent is TPasSection) then
   if not (DeclEl.Parent is TPasSection) then
     RaiseMsg(20210106224436,nSymbolCannotBeExportedFromALibrary,
     RaiseMsg(20210106224436,nSymbolCannotBeExportedFromALibrary,
       sSymbolCannotBeExportedFromALibrary,[],El);
       sSymbolCannotBeExportedFromALibrary,[],El);
+
+  if not (DeclEl.Parent is TLibrarySection) then
+    // disable exports in units
+    RaiseMsg(20211022224239,nSymbolCannotBeExportedFromALibrary,
+      sSymbolCannotBeExportedFromALibrary,[],El);
+
   if DeclEl is TPasProcedure then
   if DeclEl is TPasProcedure then
     begin
     begin
     Proc:=TPasProcedure(DeclEl);
     Proc:=TPasProcedure(DeclEl);