fcl-passrc: added bool option methodcallcheck

git-svn-id: trunk@37996 -
This commit is contained in:
Mattias Gaertner 2018-01-18 17:22:40 +00:00
parent 61d0d8717a
commit 58fac6e844
3 changed files with 16 additions and 37 deletions

View File

@ -505,10 +505,6 @@ type
TPasScopeClass = class of TPasScope;
TPasModuleScopeFlag = (
pmsfAssertions, // $Assertions on
pmsfHints, // $Hints on for analyzer (runs at end of module, so have to safe Scanner flags)
pmsfNotes, // $Notes on for analyzer
pmsfWarnings, // $Warnings on for analyzer
pmsfAssertSearched // assert constructors searched
);
TPasModuleScopeFlags = set of TPasModuleScopeFlag;
@ -527,6 +523,7 @@ type
FirstName: string;
PendingResolvers: TFPList; // list of TPasResolver waiting for the unit interface
Flags: TPasModuleScopeFlags;
ScannerBoolSwitches: TBoolSwitches;
constructor Create; override;
destructor Destroy; override;
procedure IterateElements(const aName: string; StartScope: TPasScope;
@ -656,10 +653,6 @@ type
TPasClassScopeClass = class of TPasClassScope;
TPasProcedureScopeFlag = (
ppsfAssertions, // $Assertions on
ppsfHints, // $Hints on for analyzer (runs at end of module, so have to safe Scanner flags)
ppsfNotes, // $Notes on for analyzer
ppsfWarnings, // $Warnings on for analyzer
ppsfIsGroupOverload // mode objfpc: one overload is enough for all procs in same scope
);
TPasProcedureScopeFlags = set of TPasProcedureScopeFlag;
@ -675,6 +668,7 @@ type
SelfArg: TPasArgument;
Mode: TModeSwitch;
Flags: TPasProcedureScopeFlags;
ScannerBoolSwitches: TBoolSwitches;
function FindIdentifier(const Identifier: String): TPasIdentifier; override;
procedure IterateElements(const aName: string; StartScope: TPasScope;
const OnIterateElement: TIterateScopeElement; Data: Pointer;
@ -3502,7 +3496,6 @@ var
CurModuleClass: TClass;
i: Integer;
ModScope: TPasModuleScope;
ScanBools: TBoolSwitches;
begin
{$IFDEF VerbosePasResolver}
writeln('TPasResolver.FinishModule START ',CurModule.Name);
@ -3512,15 +3505,7 @@ begin
CurModuleClass:=CurModule.ClassType;
ModScope:=CurModule.CustomData as TPasModuleScope;
ScanBools:=CurrentParser.Scanner.CurrentBoolSwitches;
if bsAssertions in ScanBools then
Include(ModScope.Flags,pmsfAssertions);
if bsHints in ScanBools then
Include(ModScope.Flags,pmsfHints);
if bsNotes in ScanBools then
Include(ModScope.Flags,pmsfNotes);
if bsWarnings in ScanBools then
Include(ModScope.Flags,pmsfWarnings);
ModScope.ScannerBoolSwitches:=CurrentParser.Scanner.CurrentBoolSwitches;
if (CurModuleClass=TPasProgram) or (CurModuleClass=TPasLibrary) then
begin
@ -5232,18 +5217,8 @@ begin
end;
procedure TPasResolver.StoreScannerFlagsInProc(ProcScope: TPasProcedureScope);
var
ScanBools: TBoolSwitches;
begin
ScanBools:=CurrentParser.Scanner.CurrentBoolSwitches;
if bsAssertions in ScanBools then
Include(ProcScope.Flags,ppsfAssertions);
if bsHints in ScanBools then
Include(ProcScope.Flags,ppsfHints);
if bsNotes in ScanBools then
Include(ProcScope.Flags,ppsfNotes);
if bsWarnings in ScanBools then
Include(ProcScope.Flags,ppsfWarnings);
ProcScope.ScannerBoolSwitches:=CurrentParser.Scanner.CurrentBoolSwitches;
end;
procedure TPasResolver.ReplaceProcScopeImplArgsWithDeclArgs(

View File

@ -2062,9 +2062,9 @@ begin
if ProcScope.ImplProc<>nil then
ProcScope:=ProcScope.ImplProc.CustomData as TPasProcedureScope;
case MsgType of
mtHint: if not (ppsfHints in ProcScope.Flags) then exit;
mtNote: if not (ppsfNotes in ProcScope.Flags) then exit;
mtWarning: if not (ppsfWarnings in ProcScope.Flags) then exit;
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;
end;
break;
end
@ -2072,9 +2072,9 @@ begin
begin
ModScope:=TPasModule(El).CustomData as TPasModuleScope;
case MsgType of
mtHint: if not (pmsfHints in ModScope.Flags) then exit;
mtNote: if not (pmsfNotes in ModScope.Flags) then exit;
mtWarning: if not (pmsfWarnings in ModScope.Flags) then exit;
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;
end;
break;
end;

View File

@ -302,7 +302,8 @@ type
bsNotes,
bsWarnings,
bsMacro,
bsScopedEnums
bsScopedEnums,
bsMethodCallChecks // check type of Self
);
TBoolSwitches = set of TBoolSwitch;
const
@ -942,6 +943,7 @@ const
);
BoolSwitchNames: array[TBoolSwitch] of string = (
// letter directives
'None',
'Align',
'BoolEval',
@ -964,11 +966,13 @@ const
'Stackframes',
'ExtendedSyntax',
'ReferenceInfo',
// other bool directives
'Hints',
'Notes',
'Warnings',
'Macro',
'ScopedEnums'
'ScopedEnums',
'MethodCallChecks'
);
const