Browse Source

fcl-passrc: unified naming BoolSwitches

git-svn-id: trunk@38128 -
Mattias Gaertner 7 years ago
parent
commit
beee21c761

+ 15 - 7
packages/fcl-passrc/src/pasresolver.pp

@@ -530,7 +530,7 @@ type
     FirstName: string; // the 'unit1' in 'unit1', or 'ns' in 'ns.unit1'
     PendingResolvers: TFPList; // list of TPasResolver waiting for the unit interface
     Flags: TPasModuleScopeFlags;
-    ScannerBoolSwitches: TBoolSwitches;
+    BoolSwitches: TBoolSwitches;
     constructor Create; override;
     destructor Destroy; override;
     procedure IterateElements(const aName: string; StartScope: TPasScope;
@@ -677,7 +677,7 @@ type
     SelfArg: TPasArgument;
     Mode: TModeSwitch;
     Flags: TPasProcedureScopeFlags;
-    ScannerBoolSwitches: TBoolSwitches;
+    BoolSwitches: TBoolSwitches;
     function FindIdentifier(const Identifier: String): TPasIdentifier; override;
     procedure IterateElements(const aName: string; StartScope: TPasScope;
       const OnIterateElement: TIterateScopeElement; Data: Pointer;
@@ -3631,13 +3631,20 @@ begin
   CurModuleClass:=CurModule.ClassType;
   ModScope:=CurModule.CustomData as TPasModuleScope;
 
-  ModScope.ScannerBoolSwitches:=CurrentParser.Scanner.CurrentBoolSwitches;
-  if bsRangeChecks in ModScope.ScannerBoolSwitches then
+  ModScope.BoolSwitches:=CurrentParser.Scanner.CurrentBoolSwitches;
+  if bsRangeChecks in ModScope.BoolSwitches then
     Include(ModScope.Flags,pmsfRangeErrorNeeded);
   FindRangeErrorConstructors(CurModule);
 
-  if (CurModuleClass=TPasProgram) or (CurModuleClass=TPasLibrary) then
+  if (CurModuleClass=TPasProgram) then
     begin
+    FinishSection(TPasProgram(CurModule).ProgramSection);
+    // resolve begin..end block
+    ResolveImplBlock(CurModule.InitializationSection);
+    end
+  else if (CurModuleClass=TPasLibrary) then
+    begin
+    FinishSection(TPasLibrary(CurModule).LibrarySection);
     // resolve begin..end block
     ResolveImplBlock(CurModule.InitializationSection);
     end
@@ -3645,6 +3652,7 @@ begin
     begin
     // unit
     FinishSection(CurModule.InterfaceSection);
+    FinishSection(CurModule.ImplementationSection);
     if CurModule.FinalizationSection<>nil then
       // finalization section finished -> resolve
       ResolveImplBlock(CurModule.FinalizationSection);
@@ -5346,8 +5354,8 @@ procedure TPasResolver.StoreScannerFlagsInProc(ProcScope: TPasProcedureScope);
 var
   ModScope: TPasModuleScope;
 begin
-  ProcScope.ScannerBoolSwitches:=CurrentParser.Scanner.CurrentBoolSwitches;
-  if bsRangeChecks in ProcScope.ScannerBoolSwitches then
+  ProcScope.BoolSwitches:=CurrentParser.Scanner.CurrentBoolSwitches;
+  if bsRangeChecks in ProcScope.BoolSwitches then
     begin
     ModScope:=RootElement.CustomData as TPasModuleScope;
     Include(ModScope.Flags,pmsfRangeErrorNeeded);

+ 1 - 0
packages/fcl-passrc/src/pastree.pp

@@ -344,6 +344,7 @@ type
     UsesClause: TPasUsesClause;
     PendingUsedIntf: TPasUsesUnit; // <>nil while resolving a uses cycle
   end;
+  TPasSectionClass = class of TPasSection;
 
   { TInterfaceSection }
 

+ 6 - 6
packages/fcl-passrc/src/pasuseanalyzer.pas

@@ -2079,9 +2079,9 @@ begin
         if ProcScope.ImplProc<>nil then
           ProcScope:=ProcScope.ImplProc.CustomData as TPasProcedureScope;
         case MsgType of
-        mtHint: if not (bsHints in ProcScope.ScannerBoolSwitches) then exit;
-        mtNote: if not (bsNotes in ProcScope.ScannerBoolSwitches) then exit;
-        mtWarning: if not (bsWarnings in ProcScope.ScannerBoolSwitches) then exit;
+        mtHint: if not (bsHints in ProcScope.BoolSwitches) then exit;
+        mtNote: if not (bsNotes in ProcScope.BoolSwitches) then exit;
+        mtWarning: if not (bsWarnings in ProcScope.BoolSwitches) then exit;
         end;
         break;
         end
@@ -2089,9 +2089,9 @@ begin
         begin
         ModScope:=TPasModule(El).CustomData as TPasModuleScope;
         case MsgType of
-        mtHint: if not (bsHints in ModScope.ScannerBoolSwitches) then exit;
-        mtNote: if not (bsNotes in ModScope.ScannerBoolSwitches) then exit;
-        mtWarning: if not (bsWarnings in ModScope.ScannerBoolSwitches) then exit;
+        mtHint: if not (bsHints in ModScope.BoolSwitches) then exit;
+        mtNote: if not (bsNotes in ModScope.BoolSwitches) then exit;
+        mtWarning: if not (bsWarnings in ModScope.BoolSwitches) then exit;
         end;
         break;
         end;