mirror of https://gitlab.com/basile.b/dexed.git
more `<> nil` and `= nil` replaced with isAss/isNotAss
and inline those helpers
This commit is contained in:
parent
a2a53632d8
commit
0b641095be
|
@ -706,7 +706,7 @@ begin
|
|||
// field is specified
|
||||
if fOutputFilename.isNotEmpty then
|
||||
begin
|
||||
if (fSymStringExpander <> nil) then
|
||||
if fSymStringExpander.isAssigned then
|
||||
fOutputFilename := fSymStringExpander.expand(fOutputFilename);
|
||||
fOutputFilename := expandFilenameEx(fBasePath, fOutputFilename);
|
||||
{$IFDEF WINDOWS}
|
||||
|
|
|
@ -147,12 +147,12 @@ inherited ProjectConfigurationWidget: TProjectConfigurationWidget
|
|||
end
|
||||
end
|
||||
inherited contextMenu: TPopupMenu
|
||||
left = 8
|
||||
top = 8
|
||||
Left = 8
|
||||
Top = 8
|
||||
end
|
||||
object imgList: TImageList[2]
|
||||
left = 40
|
||||
top = 8
|
||||
Left = 40
|
||||
Top = 8
|
||||
Bitmap = {
|
||||
4C690200000010000000100000008D8B89008D8B89008F8D8B008F8D8B008C8A
|
||||
880092908E00908E8CFF8F8D8BFF908E8CFF92908E008F8D8B008F8D8B008F8D
|
||||
|
|
|
@ -225,7 +225,7 @@ begin
|
|||
fProj.beginUpdate;
|
||||
try
|
||||
src_prop := src_list.Find(propstr);
|
||||
if src_prop = nil then
|
||||
if src_prop <> nil then
|
||||
exit;
|
||||
storage.AObject := getGridTarget;
|
||||
storage.StoreAnyProperty(src_prop);
|
||||
|
|
|
@ -64,8 +64,8 @@ type
|
|||
|
||||
// sugar for classes
|
||||
TObjectHelper = class helper for TObject
|
||||
function isNotAssigned: boolean;
|
||||
function isAssigned: boolean;
|
||||
function isNotAssigned: boolean; inline;
|
||||
function isAssigned: boolean; inline;
|
||||
end;
|
||||
|
||||
IDexedBaseInterface = interface
|
||||
|
@ -73,8 +73,8 @@ type
|
|||
|
||||
// sugar for interfaces
|
||||
TDexedInterfaceHelper = type helper for IDexedBaseInterface
|
||||
function isNotAssigned: boolean;
|
||||
function isAssigned: boolean;
|
||||
function isNotAssigned: boolean; inline;
|
||||
function isAssigned: boolean; inline;
|
||||
end;
|
||||
|
||||
// maybe one day, sugar for events
|
||||
|
@ -85,8 +85,8 @@ type
|
|||
|
||||
// sugar for pointers
|
||||
TPointerHelper = type helper for Pointer
|
||||
function isNotAssigned: boolean;
|
||||
function isAssigned: boolean;
|
||||
function isNotAssigned: boolean; inline;
|
||||
function isAssigned: boolean; inline;
|
||||
end;
|
||||
|
||||
// sugar for strings
|
||||
|
@ -956,7 +956,7 @@ begin
|
|||
listFiles(files, pth, true);
|
||||
for fname in files do
|
||||
begin
|
||||
if exts = nil then
|
||||
if exts.isNotAssigned then
|
||||
list.Add(fname)
|
||||
else
|
||||
begin
|
||||
|
|
|
@ -1203,7 +1203,7 @@ end;
|
|||
|
||||
procedure TSynD2Syn.ResetRange;
|
||||
begin
|
||||
if fCurrRange = nil then
|
||||
if fCurrRange.isNotAssigned then
|
||||
fCurrRange := TSynD2SynRange.Create(nil)
|
||||
else
|
||||
fCurrRange.Clear;
|
||||
|
|
|
@ -1684,7 +1684,7 @@ var
|
|||
fe: boolean;
|
||||
i: integer;
|
||||
begin
|
||||
if (base = nil) or (base = self) then
|
||||
if base.isNotAssigned or (base = self) then
|
||||
begin
|
||||
fDocOpts.getOpts(list);
|
||||
fDebugOpts.getOpts(list);
|
||||
|
|
|
@ -1921,7 +1921,7 @@ const
|
|||
asmFlavorStr: array[TAsmSyntax] of string = ('intel','att');
|
||||
begin
|
||||
clearDisplays;
|
||||
if (fDebugTargetKind = dtkProject) and (fProj = nil) then
|
||||
if (fDebugTargetKind = dtkProject) and fProj.isNotAssigned then
|
||||
begin
|
||||
dlgOkInfo('No project to debug', 'GDB commander');
|
||||
exit;
|
||||
|
@ -2084,7 +2084,7 @@ begin
|
|||
dbgeeOptsEd.ItemIndex:=-1;
|
||||
dbgeeOptsEd.TIObject := nil;
|
||||
case fDebugTargetKind of
|
||||
dtkProject : if fProj <> nil then
|
||||
dtkProject : if fProj.isAssigned then
|
||||
nme := fProj.filename;
|
||||
dtkRunnable : if fDoc.isAssigned then
|
||||
nme := fDoc.filename;
|
||||
|
@ -2727,7 +2727,7 @@ procedure TGdbWidget.gdboutJsonize(sender: TObject);
|
|||
var
|
||||
str: string;
|
||||
begin
|
||||
if fMsg = nil then
|
||||
if fMsg.isNotAssigned then
|
||||
exit;
|
||||
|
||||
fLog.Clear;
|
||||
|
|
|
@ -597,7 +597,7 @@ end;
|
|||
{$REGION ISingleService getters ----------------------------------------------}
|
||||
function getMessageDisplay(var obj: IMessagesDisplay): IMessagesDisplay;
|
||||
begin
|
||||
if obj = nil then
|
||||
if obj.isNotAssigned then
|
||||
obj := EntitiesConnector.getSingleService('IMessagesDisplay') as IMessagesDisplay;
|
||||
exit(obj);
|
||||
end;
|
||||
|
@ -609,7 +609,7 @@ end;
|
|||
|
||||
function getprocInputHandler(var obj: IProcInputHandler): IProcInputHandler;
|
||||
begin
|
||||
if obj = nil then
|
||||
if obj.isNotAssigned then
|
||||
obj := EntitiesConnector.getSingleService('IProcInputHandler') as IProcInputHandler;
|
||||
exit(obj);
|
||||
end;
|
||||
|
@ -621,7 +621,7 @@ end;
|
|||
|
||||
function getMultiDocHandler(var obj: IMultiDocHandler): IMultiDocHandler;
|
||||
begin
|
||||
if obj = nil then
|
||||
if obj.isNotAssigned then
|
||||
obj := EntitiesConnector.getSingleService('IMultiDocHandler') as IMultiDocHandler;
|
||||
exit(obj);
|
||||
end;
|
||||
|
|
|
@ -561,7 +561,7 @@ var
|
|||
lib: TLibraryItem;
|
||||
i: Integer;
|
||||
begin
|
||||
if fMsgs = nil then
|
||||
if fMsgs.isNotAssigned then
|
||||
fMsgs := getMessageDisplay;
|
||||
// no selector = all libs
|
||||
if aliases.isNotAssigned then
|
||||
|
@ -599,7 +599,7 @@ var
|
|||
dep: TLibraryItem;
|
||||
sel: TLibraryList;
|
||||
begin
|
||||
if fMsgs = nil then
|
||||
if fMsgs.isNotAssigned then
|
||||
fMsgs := getMessageDisplay;
|
||||
imp := TStringList.Create;
|
||||
sel := TLibraryList.create;
|
||||
|
|
|
@ -113,7 +113,7 @@ procedure TLibManEditorWidget.updateButtonsState;
|
|||
var
|
||||
i: TIconScaledSize;
|
||||
begin
|
||||
btnReg.Enabled := (fProj <> nil) and fProj.Filename.fileExists;
|
||||
btnReg.Enabled := fProj.isAssigned and fProj.Filename.fileExists;
|
||||
btnOpenProj.Enabled := List.Selected.isAssigned and
|
||||
List.Selected.SubItems[2].fileExists;
|
||||
i := GetIconScaledSize;
|
||||
|
@ -152,7 +152,7 @@ end;
|
|||
|
||||
procedure TLibManEditorWidget.projChanged(project: ICommonProject);
|
||||
begin
|
||||
if fProj = nil then
|
||||
if fProj.isNotAssigned then
|
||||
exit;
|
||||
if fProj <> project then
|
||||
exit;
|
||||
|
@ -688,7 +688,7 @@ var
|
|||
row: TListItem;
|
||||
itf: IMessagesDisplay;
|
||||
begin
|
||||
if fProj = nil then
|
||||
if fProj.isNotAssigned then
|
||||
exit;
|
||||
|
||||
fname := fProj.outputFilename;
|
||||
|
|
|
@ -3921,7 +3921,7 @@ begin
|
|||
exit;
|
||||
fProjectGroup.closeGroup;
|
||||
fProjectGroup.openGroup(TMenuItem(Sender).Hint);
|
||||
if (fProj = nil) and (fProjectGroup.getProjectIndex < fProjectGroup.projectCount) then
|
||||
if fProj.isNotAssigned and (fProjectGroup.getProjectIndex < fProjectGroup.projectCount) then
|
||||
fProjectGroup.getProject(fProjectGroup.getProjectIndex).activate();
|
||||
end;
|
||||
|
||||
|
@ -4053,7 +4053,7 @@ var
|
|||
s1: string;
|
||||
s2: string;
|
||||
begin
|
||||
if fProj = nil then
|
||||
if fProj.isNotAssigned then
|
||||
exit;
|
||||
|
||||
pth := exeFullName('dscanner' + exeExt);
|
||||
|
@ -4249,7 +4249,7 @@ begin
|
|||
finally
|
||||
free;
|
||||
end;
|
||||
if (fProj = nil) and (fProjectGroup.getProjectIndex < fProjectGroup.projectCount) then
|
||||
if fProj.isNotAssigned and (fProjectGroup.getProjectIndex < fProjectGroup.projectCount) then
|
||||
fProjectGroup.getProject(fProjectGroup.getProjectIndex).activate();
|
||||
end;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ inherited MessagesWidget: TMessagesWidget
|
|||
OnResize = toolbarResize
|
||||
object sep: TDexedToolButton[0]
|
||||
Left = 832
|
||||
Height = 28
|
||||
Height = 5
|
||||
Hint = 'Clean filtered messages'
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
|
@ -65,7 +65,7 @@ inherited MessagesWidget: TMessagesWidget
|
|||
end
|
||||
object button2: TDexedToolButton[2]
|
||||
Left = 257
|
||||
Height = 28
|
||||
Height = 5
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = 'button2'
|
||||
|
@ -82,7 +82,7 @@ inherited MessagesWidget: TMessagesWidget
|
|||
end
|
||||
object button4: TDexedToolButton[4]
|
||||
Left = 171
|
||||
Height = 28
|
||||
Height = 5
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = 'button4'
|
||||
|
@ -99,7 +99,7 @@ inherited MessagesWidget: TMessagesWidget
|
|||
end
|
||||
object button6: TDexedToolButton[6]
|
||||
Left = 113
|
||||
Height = 28
|
||||
Height = 5
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = 'button6'
|
||||
|
@ -116,7 +116,7 @@ inherited MessagesWidget: TMessagesWidget
|
|||
end
|
||||
object button8: TDexedToolButton[8]
|
||||
Left = 62
|
||||
Height = 28
|
||||
Height = 5
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = 'button8'
|
||||
|
@ -158,7 +158,7 @@ inherited MessagesWidget: TMessagesWidget
|
|||
end
|
||||
object sepCat: TDexedToolButton[12]
|
||||
Left = 29
|
||||
Height = 28
|
||||
Height = 5
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = 'sepCat'
|
||||
|
@ -168,7 +168,7 @@ inherited MessagesWidget: TMessagesWidget
|
|||
end
|
||||
end
|
||||
inherited contextMenu: TPopupMenu
|
||||
left = 32
|
||||
top = 40
|
||||
Left = 32
|
||||
Top = 40
|
||||
end
|
||||
end
|
||||
|
|
|
@ -776,7 +776,7 @@ begin
|
|||
clearbyContext(fCtxt);
|
||||
amcEdit: if fDoc.isAssigned then
|
||||
clearbyData(fDoc);
|
||||
amcProj: if fProj <> nil then
|
||||
amcProj: if fProj.isAssigned then
|
||||
clearbyData(fProj);
|
||||
end;
|
||||
end;
|
||||
|
@ -1293,7 +1293,7 @@ begin
|
|||
getMultiDocHandler.openDocument(ident);
|
||||
exit(true);
|
||||
end;
|
||||
if fProj <> nil then
|
||||
if fProj.isAssigned then
|
||||
begin
|
||||
// if fname relative to project path
|
||||
absName := expandFilenameEx(fProj.filename.extractFileDir + DirectorySeparator, ident);
|
||||
|
|
|
@ -238,7 +238,7 @@ procedure TMRUProjectList.projClosing(project: ICommonProject);
|
|||
var
|
||||
fname: string;
|
||||
begin
|
||||
if project = nil then
|
||||
if project.isNotAssigned then
|
||||
exit;
|
||||
|
||||
fname := project.filename;
|
||||
|
|
|
@ -174,7 +174,7 @@ end;
|
|||
|
||||
procedure TEntitiesConnector.addSubject(subject: TObject);
|
||||
begin
|
||||
if (subject as ISubject) = nil then
|
||||
if (subject as ISubject).isNotAssigned then
|
||||
exit;
|
||||
if fSubjects.IndexOf(subject) <> -1 then
|
||||
exit;
|
||||
|
@ -188,7 +188,7 @@ var
|
|||
begin
|
||||
fObservers.Remove(observer);
|
||||
for i := 0 to fSubjects.Count - 1 do
|
||||
if fSubjects[i] <> nil then
|
||||
if fSubjects[i].isAssigned then
|
||||
(fSubjects[i] as ISubject).removeObserver(observer);
|
||||
tryUpdate;
|
||||
end;
|
||||
|
|
|
@ -208,7 +208,7 @@ begin
|
|||
end else
|
||||
begin
|
||||
dt := PCategoryData(selCat.Selected.Data);
|
||||
if dt^.container.isNotAssigned or (dt^.observer = nil) then
|
||||
if dt^.container.isNotAssigned or dt^.observer.isNotAssigned then
|
||||
exit;
|
||||
if dt^.observer.optionedOptionsModified() then
|
||||
begin
|
||||
|
|
|
@ -102,7 +102,7 @@ implementation
|
|||
|
||||
procedure killProcess(var proc: TDexedProcess);
|
||||
begin
|
||||
if proc = nil then
|
||||
if proc.isNotAssigned then
|
||||
exit;
|
||||
if proc.Running then
|
||||
proc.Terminate(0);
|
||||
|
@ -217,7 +217,7 @@ procedure TDexedProcess.fillOutputStack;
|
|||
c: integer;
|
||||
begin
|
||||
s := outStr.size;
|
||||
while (inStr <> nil) and (inStr.NumBytesAvailable > 0) do
|
||||
while inStr.isAssigned and (inStr.NumBytesAvailable > 0) do
|
||||
begin
|
||||
outStr.SetSize(s + 1024);
|
||||
c := inStr.Read((outStr.Memory + s)^, 1024);
|
||||
|
|
|
@ -212,13 +212,13 @@ end;
|
|||
|
||||
procedure TProjectGroup.projClosing(project: ICommonProject);
|
||||
begin
|
||||
if (project <> nil) and (project = fFreeStanding) then
|
||||
if project.isAssigned and (project = fFreeStanding) then
|
||||
fFreeStanding := nil;
|
||||
end;
|
||||
|
||||
procedure TProjectGroup.projFocused(project: ICommonProject);
|
||||
begin
|
||||
if (project <> nil) and not project.inGroup then
|
||||
if project.isAssigned and not project.inGroup then
|
||||
fFreeStanding := project;
|
||||
end;
|
||||
|
||||
|
@ -490,25 +490,24 @@ end;
|
|||
|
||||
procedure TProjectGroupItem.lazyLoad;
|
||||
begin
|
||||
if fProj = nil then
|
||||
begin
|
||||
if fProj.isAssigned then
|
||||
exit;
|
||||
|
||||
//setActiveConfigurationIndex changes the project
|
||||
//modified flag
|
||||
projectGroup.saveModified;
|
||||
//setActiveConfigurationIndex changes the project
|
||||
//modified flag
|
||||
projectGroup.saveModified;
|
||||
|
||||
fProj := loadProject(absoluteFilename, true);
|
||||
fProj.inGroup(true);
|
||||
if fProj.getFormat = pfDUB then
|
||||
fProj.setActiveConfigurationIndex(fConfigIndex);
|
||||
fProj := loadProject(absoluteFilename, true);
|
||||
fProj.inGroup(true);
|
||||
if fProj.getFormat = pfDUB then
|
||||
fProj.setActiveConfigurationIndex(fConfigIndex);
|
||||
|
||||
projectGroup.restoreModified;
|
||||
end;
|
||||
projectGroup.restoreModified;
|
||||
end;
|
||||
|
||||
destructor TProjectGroupItem.destroy;
|
||||
begin
|
||||
if fProj <> nil then
|
||||
if fProj.isAssigned then
|
||||
fProj.getProject.free;
|
||||
fProj := nil;
|
||||
inherited;
|
||||
|
@ -634,7 +633,7 @@ begin
|
|||
exit;
|
||||
for fname in Files do
|
||||
begin
|
||||
if projectGroup.findProject(fname.normalizePath) <> nil then
|
||||
if projectGroup.findProject(fname.normalizePath).isAssigned then
|
||||
continue;
|
||||
projectGroup.addItem(fname.normalizePath);
|
||||
added := true;
|
||||
|
@ -648,15 +647,13 @@ end;
|
|||
|
||||
procedure TProjectGroupWidget.btnFreeFocusClick(Sender: TObject);
|
||||
begin
|
||||
if fFreeProj <> nil then
|
||||
if fFreeProj.isAssigned then
|
||||
subjProjFocused(fProjSubj, fFreeProj);
|
||||
end;
|
||||
|
||||
procedure TProjectGroupWidget.btnAddUnfocusedClick(Sender: TObject);
|
||||
begin
|
||||
if fFreeProj = nil then
|
||||
exit;
|
||||
if not fFreeProj.filename.fileExists then
|
||||
if fFreeProj.isNotAssigned or not fFreeProj.filename.fileExists then
|
||||
exit;
|
||||
projectGroup.addProject(fFreeProj);
|
||||
fFreeProj := nil;
|
||||
|
@ -806,7 +803,7 @@ begin
|
|||
lstProj.ItemIndex:= i;
|
||||
end;
|
||||
lstProj.EndUpdate;
|
||||
if fFreeProj <> nil then
|
||||
if fFreeProj.isAssigned then
|
||||
begin
|
||||
if fFreeProj.filename.fileExists then
|
||||
case fFreeProj.getFormat of
|
||||
|
|
|
@ -238,7 +238,7 @@ end;
|
|||
|
||||
procedure TProjectInspectWidget.actBuildExecute(sender: TObject);
|
||||
begin
|
||||
if fProj <> nil then
|
||||
if fProj.isAssigned then
|
||||
begin
|
||||
actOpenFileExecute(sender);
|
||||
fProj.compile;
|
||||
|
|
|
@ -259,12 +259,12 @@ inherited SearchWidget: TSearchWidget
|
|||
end
|
||||
end
|
||||
inherited contextMenu: TPopupMenu
|
||||
left = 216
|
||||
top = 16
|
||||
Left = 216
|
||||
Top = 16
|
||||
end
|
||||
object imgList: TImageList[2]
|
||||
left = 248
|
||||
top = 16
|
||||
Left = 248
|
||||
Top = 16
|
||||
Bitmap = {
|
||||
4C690200000010000000100000007B7977007B7977007B7977FF73716FFF6D6B
|
||||
69FF696665FF625F5EFF615E5D007E7C7A007B7977FF73716FFF6D6B69FF6966
|
||||
|
|
|
@ -390,8 +390,8 @@ var
|
|||
h: IMultiDocHandler;
|
||||
begin
|
||||
if (fDoc.isNotAssigned and (fFindScope <> scProj)) or
|
||||
((fProj = nil) and (fFindScope = scProj)) then
|
||||
exit;
|
||||
(fProj.isNotAssigned and (fFindScope = scProj)) then
|
||||
exit;
|
||||
|
||||
fSearchMru.Insert(0,fToFind);
|
||||
cbToFind.Items.Assign(fSearchMru);
|
||||
|
@ -829,7 +829,7 @@ var
|
|||
hasTxt: boolean;
|
||||
begin
|
||||
canAll := ((fDoc.isAssigned and (fFindScope <> scProj)) or
|
||||
((fFindScope = scProj) and (fProj <> nil)));
|
||||
((fFindScope = scProj) and fProj.isAssigned));
|
||||
hasTxt := fToFind.isNotEmpty and not fToFind.isBlank;
|
||||
btnFind.Enabled := fDoc.isAssigned and hasTxt;
|
||||
btnFindAll.Enabled := canAll and hasTxt;
|
||||
|
|
|
@ -190,7 +190,7 @@ begin
|
|||
fNeedUpdate := false;
|
||||
|
||||
hasNativeProj := fProj.isAssigned;
|
||||
hasProjItf := fProjInterface <> nil;
|
||||
hasProjItf := fProjInterface.isAssigned;
|
||||
hasDoc := fDoc.isAssigned;
|
||||
if fExp.isNotAssigned then
|
||||
fExp := getExplorer;
|
||||
|
|
|
@ -1065,7 +1065,7 @@ begin
|
|||
fScrollMemo := TScrollMemo.construct(self);
|
||||
|
||||
i := getLifeTimeManager();
|
||||
if (i <> nil) then
|
||||
if i.isAssigned then
|
||||
fLifeTimeManager := i.asObject;
|
||||
|
||||
OnShowHint:= @showHintEvent;
|
||||
|
|
|
@ -434,9 +434,9 @@ begin
|
|||
c := getContext;
|
||||
case c of
|
||||
tcNone: exit;
|
||||
tcProject: if (fProj = nil) or fProj.sourcesCount.equals(0) then
|
||||
tcProject: if fProj.isNotAssigned or fProj.sourcesCount.equals(0) then
|
||||
exit;
|
||||
tcFile: if fDoc = nil then
|
||||
tcFile: if fDoc.isNotAssigned then
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
|
|
@ -219,11 +219,11 @@ begin
|
|||
u_processes.killProcess(fProcess);
|
||||
fTerminatedFlag := false;
|
||||
|
||||
if fMsgs = nil then
|
||||
if fMsgs.isNotAssigned then
|
||||
fMsgs := getMessageDisplay;
|
||||
if fClearMessages then
|
||||
fMsgs.clearByContext(amcMisc);
|
||||
if fSymStringExpander = nil then
|
||||
if fSymStringExpander.isNotAssigned then
|
||||
fSymStringExpander:= getSymStringExpander;
|
||||
|
||||
if askConfirmation and (dlgOkCancel(format(confSpec, [toolAlias])) <> mrOk) then
|
||||
|
|
|
@ -9,6 +9,7 @@ object DexedWidget: TDexedWidget
|
|||
ClientWidth = 332
|
||||
ShowHint = True
|
||||
ShowInTaskBar = stNever
|
||||
LCLVersion = '2.0.10.0'
|
||||
object Back: TPanel
|
||||
Left = 0
|
||||
Height = 121
|
||||
|
|
|
@ -208,7 +208,7 @@ begin
|
|||
if isDockable then
|
||||
begin
|
||||
win := DockMaster.GetAnchorSite(self);
|
||||
if win <> nil then
|
||||
if win.isAssigned then
|
||||
begin
|
||||
win.Show;
|
||||
win.BringToFront;
|
||||
|
|
Loading…
Reference in New Issue