Browse Source

* Change two precondition checks into assertions.

git-svn-id: trunk@3836 -
daniel 19 years ago
parent
commit
31c77b43d8
1 changed files with 6 additions and 4 deletions
  1. 6 4
      ide/weditor.pas

+ 6 - 4
ide/weditor.pas

@@ -1485,7 +1485,9 @@ end;
 
 
 destructor TEditorLineInfo.Done;
 destructor TEditorLineInfo.Done;
 begin
 begin
-  if Format<>nil then DisposeStr(Format); Format:=nil;
+  if Format<>nil then
+    DisposeStr(Format);
+  Format:=nil;
   SetFold(nil);
   SetFold(nil);
   inherited Done;
   inherited Done;
 end;
 end;
@@ -1522,8 +1524,7 @@ var B: PEditorBinding;
     Count,I,Idx: sw_integer;
     Count,I,Idx: sw_integer;
     L: PCustomLine;
     L: PCustomLine;
 begin
 begin
-  if Assigned(AEditor)=false then Exit;
-
+  assert(Aeditor<>nil);
   New(B, Init(AEditor));
   New(B, Init(AEditor));
   Bindings^.Insert(B);
   Bindings^.Insert(B);
   Idx:=Bindings^.IndexOf(B);
   Idx:=Bindings^.IndexOf(B);
@@ -1543,6 +1544,7 @@ var B: PEditorBinding;
     Count,I: sw_integer;
     Count,I: sw_integer;
     L: PCustomLine;
     L: PCustomLine;
 begin
 begin
+  assert(Aeditor<>nil);
   B:=SearchBinding(AEditor);
   B:=SearchBinding(AEditor);
   if Assigned(B) then
   if Assigned(B) then
   begin
   begin
@@ -3044,7 +3046,7 @@ begin
       Inc(LineDelta);
       Inc(LineDelta);
       OK:=GetLineCount<MaxLineCount;
       OK:=GetLineCount<MaxLineCount;
     end;
     end;
-    if OK=false then EditorDialog(edTooManyLines,nil);
+    if not OK then EditorDialog(edTooManyLines,nil);
     { mainly to force eaMove insertion }
     { mainly to force eaMove insertion }
     if not IsClipboard then
     if not IsClipboard then
       SetCurPtr(EPos.X,EPos.Y);
       SetCurPtr(EPos.X,EPos.Y);