Browse Source

rtl: less hints

mattias 7 years ago
parent
commit
9ecd3f5c46

+ 38 - 38
packages/rtl/contnrs.pas

@@ -35,7 +35,7 @@ Type
     Procedure SetCapacity(NewCapacity: Integer);
     Procedure SetCapacity(NewCapacity: Integer);
     Function GetCapacity: integer;
     Function GetCapacity: integer;
   public
   public
-    constructor Create;
+    constructor Create; reintroduce;
     constructor Create(FreeObjects : Boolean);
     constructor Create(FreeObjects : Boolean);
     destructor Destroy; override;
     destructor Destroy; override;
     Procedure Clear;
     Procedure Clear;
@@ -73,16 +73,16 @@ Type
     Function GetItem(Index: Integer): TObject;
     Function GetItem(Index: Integer): TObject;
     Procedure SetItem(Index: Integer; AObject: TObject);
     Procedure SetItem(Index: Integer; AObject: TObject);
   public
   public
-    constructor Create;
+    constructor Create; reintroduce;
     constructor Create(FreeObjects : boolean);
     constructor Create(FreeObjects : boolean);
-    Function Add(AObject: TObject): Integer;
-    Function Extract(Item: TObject): TObject;
-    Function Remove(AObject: TObject): Integer;
-    Function IndexOf(AObject: TObject): Integer;
+    Function Add(AObject: TObject): Integer; reintroduce;
+    Function Extract(Item: TObject): TObject; reintroduce;
+    Function Remove(AObject: TObject): Integer; reintroduce;
+    Function IndexOf(AObject: TObject): Integer; reintroduce;
     Function FindInstanceOf(AClass: TClass; AExact: Boolean; AStartAt: Integer): Integer;
     Function FindInstanceOf(AClass: TClass; AExact: Boolean; AStartAt: Integer): Integer;
-    Procedure Insert(Index: Integer; AObject: TObject);
-    Function First: TObject;
-    Function Last: TObject;
+    Procedure Insert(Index: Integer; AObject: TObject); reintroduce;
+    Function First: TObject; reintroduce;
+    Function Last: TObject; reintroduce;
     property OwnsObjects: Boolean read FFreeObjects write FFreeObjects;
     property OwnsObjects: Boolean read FFreeObjects write FFreeObjects;
     property Items[Index: Integer]: TObject read GetItem write SetItem; default;
     property Items[Index: Integer]: TObject read GetItem write SetItem; default;
   end;
   end;
@@ -97,13 +97,13 @@ Type
     Procedure HandleFreeNotify(Sender: TObject; AComponent: TComponent);
     Procedure HandleFreeNotify(Sender: TObject; AComponent: TComponent);
   public
   public
     destructor Destroy; override;
     destructor Destroy; override;
-    Function Add(AComponent: TComponent): Integer;
-    Function Extract(Item: TComponent): TComponent;
-    Function Remove(AComponent: TComponent): Integer;
-    Function IndexOf(AComponent: TComponent): Integer;
-    Function First: TComponent;
-    Function Last: TComponent;
-    Procedure Insert(Index: Integer; AComponent: TComponent);
+    Function Add(AComponent: TComponent): Integer; reintroduce;
+    Function Extract(Item: TComponent): TComponent; reintroduce;
+    Function Remove(AComponent: TComponent): Integer; reintroduce;
+    Function IndexOf(AComponent: TComponent): Integer; reintroduce;
+    Function First: TComponent; reintroduce;
+    Function Last: TComponent; reintroduce;
+    Procedure Insert(Index: Integer; AComponent: TComponent); reintroduce;
     property Items[Index: Integer]: TComponent read GetItems write SetItems; default;
     property Items[Index: Integer]: TComponent read GetItems write SetItems; default;
   end;
   end;
 
 
@@ -112,13 +112,13 @@ Type
     Function GetItems(Index: Integer): TClass;
     Function GetItems(Index: Integer): TClass;
     Procedure SetItems(Index: Integer; AClass: TClass);
     Procedure SetItems(Index: Integer; AClass: TClass);
   public
   public
-    Function Add(AClass: TClass): Integer;
-    Function Extract(Item: TClass): TClass;
-    Function Remove(AClass: TClass): Integer;
-    Function IndexOf(AClass: TClass): Integer;
-    Function First: TClass;
-    Function Last: TClass;
-    Procedure Insert(Index: Integer; AClass: TClass);
+    Function Add(AClass: TClass): Integer; reintroduce;
+    Function Extract(Item: TClass): TClass; reintroduce;
+    Function Remove(AClass: TClass): Integer; reintroduce;
+    Function IndexOf(AClass: TClass): Integer; reintroduce;
+    Function First: TClass; reintroduce;
+    Function Last: TClass; reintroduce;
+    Procedure Insert(Index: Integer; AClass: TClass); reintroduce;
     property Items[Index: Integer]: TClass read GetItems write SetItems; default;
     property Items[Index: Integer]: TClass read GetItems write SetItems; default;
   end;
   end;
 
 
@@ -131,7 +131,7 @@ Type
     Function PeekItem: JSValue; virtual;
     Function PeekItem: JSValue; virtual;
     property List: TList read FList;
     property List: TList read FList;
   public
   public
-    constructor Create;
+    constructor Create; reintroduce;
     destructor Destroy; override;
     destructor Destroy; override;
     Function Count: Integer;
     Function Count: Integer;
     Function AtLeast(ACount: Integer): Boolean;
     Function AtLeast(ACount: Integer): Boolean;
@@ -151,9 +151,9 @@ Type
 
 
   TObjectStack = class(TStack)
   TObjectStack = class(TStack)
   public
   public
-    Function Push(AObject: TObject): TObject;
-    Function Pop: TObject;
-    Function Peek: TObject;
+    Function Push(AObject: TObject): TObject; reintroduce;
+    Function Pop: TObject; reintroduce;
+    Function Peek: TObject; reintroduce;
   end;
   end;
 
 
 { TQueue class }
 { TQueue class }
@@ -167,9 +167,9 @@ Type
 
 
   TObjectQueue = class(TQueue)
   TObjectQueue = class(TQueue)
   public
   public
-    Function Push(AObject: TObject): TObject;
-    Function Pop: TObject;
-    Function Peek: TObject;
+    Function Push(AObject: TObject): TObject; reintroduce;
+    Function Pop: TObject; reintroduce;
+    Function Peek: TObject; reintroduce;
   end;
   end;
 
 
 { ---------------------------------------------------------------------
 { ---------------------------------------------------------------------
@@ -220,7 +220,7 @@ Type
     Procedure SetHashFunction(AHashFunction: THashFunction); virtual;
     Procedure SetHashFunction(AHashFunction: THashFunction); virtual;
     Function FindChainForAdd(Const aKey : String) : TFPObjectList;
     Function FindChainForAdd(Const aKey : String) : TFPObjectList;
   public
   public
-    constructor Create;
+    constructor Create; reintroduce;
     constructor CreateWith(AHashTableSize: Longword; aHashFunc: THashFunction);
     constructor CreateWith(AHashTableSize: Longword; aHashFunc: THashFunction);
     destructor Destroy; override;
     destructor Destroy; override;
     Procedure ChangeTableSize(const ANewSize: Longword); virtual;
     Procedure ChangeTableSize(const ANewSize: Longword); virtual;
@@ -332,8 +332,8 @@ Type
     Function GetData(const index: string): TObject; virtual;
     Function GetData(const index: string): TObject; virtual;
     Function ForEachCall(aMethod: TObjectIteratorMethod): THTObjectNode; virtual;
     Function ForEachCall(aMethod: TObjectIteratorMethod): THTObjectNode; virtual;
   Public
   Public
-    constructor Create(AOwnsObjects : Boolean = True);
-    constructor CreateWith(AHashTableSize: Longword; aHashFunc: THashFunction; AOwnsObjects : Boolean = True);
+    constructor Create(AOwnsObjects : Boolean = True); reintroduce;
+    constructor CreateWith(AHashTableSize: Longword; aHashFunc: THashFunction; AOwnsObjects : Boolean = True); reintroduce;
     Function Iterate(aMethod: TObjectIteratorMethod): TObject; virtual;
     Function Iterate(aMethod: TObjectIteratorMethod): TObject; virtual;
     Function Iterate(aMethod: TObjectIteratorCallback): TObject; virtual;
     Function Iterate(aMethod: TObjectIteratorCallback): TObject; virtual;
     Procedure Add(const aKey: string; AItem : TObject); virtual;
     Procedure Add(const aKey: string; AItem : TObject); virtual;
@@ -415,7 +415,7 @@ Type
   protected
   protected
     Function BucketFor(AItem: JSValue): Integer; override;
     Function BucketFor(AItem: JSValue): Integer; override;
   public
   public
-    constructor Create(ABuckets: TBucketListSizes = bl16);
+    constructor Create(ABuckets: TBucketListSizes = bl16); reintroduce;
   end;
   end;
 
 
 { ---------------------------------------------------------------------
 { ---------------------------------------------------------------------
@@ -426,11 +426,11 @@ Type
 
 
   TObjectBucketList = class(TBucketList)
   TObjectBucketList = class(TBucketList)
   protected
   protected
-    Function GetData(AItem: TObject): TObject;
-    Procedure SetData(AItem: TObject; const AData: TObject);
+    Function GetData(AItem: TObject): TObject; reintroduce;
+    Procedure SetData(AItem: TObject; const AData: TObject); reintroduce;
   public
   public
-    Function Add(AItem, AData: TObject): TObject;
-    Function Remove(AItem: TObject): TObject;
+    Function Add(AItem, AData: TObject): TObject; reintroduce;
+    Function Remove(AItem: TObject): TObject; reintroduce;
     property Data[AItem: TObject]: TObject read GetData write SetData; default;
     property Data[AItem: TObject]: TObject read GetData write SetData; default;
   end;
   end;
 
 

+ 13 - 3
packages/rtl/pas2js_rtl.lpk

@@ -10,18 +10,28 @@
       <Parsing>
       <Parsing>
         <SyntaxOptions>
         <SyntaxOptions>
           <AllowLabel Value="False"/>
           <AllowLabel Value="False"/>
+          <CPPInline Value="False"/>
+          <UseAnsiStrings Value="False"/>
         </SyntaxOptions>
         </SyntaxOptions>
       </Parsing>
       </Parsing>
+      <CodeGeneration>
+        <Optimizations>
+          <OptimizationLevel Value="0"/>
+        </Optimizations>
+      </CodeGeneration>
       <Linking>
       <Linking>
         <Debugging>
         <Debugging>
           <GenerateDebugInfo Value="False"/>
           <GenerateDebugInfo Value="False"/>
         </Debugging>
         </Debugging>
       </Linking>
       </Linking>
       <Other>
       <Other>
-        <CustomOptions Value="-dPas2js"/>
+        <CustomOptions Value="-dPas2js -O- -Jc"/>
+        <CompilerPath Value="pas2js"/>
         <ExecuteBefore>
         <ExecuteBefore>
-          <Command Value="$MakeExe(pas2js) -O- -Jc pas2js_rtl.pas"/>
-          <ScanForFPCMsgs Value="True"/>
+          <Command Value="$MakeExe(IDE,pas2js) -O- -Jc -vbq pas2js_rtl.pas"/>
+          <Parsers Count="1">
+            <Item1 Value="Pas2JS"/>
+          </Parsers>
         </ExecuteBefore>
         </ExecuteBefore>
       </Other>
       </Other>
       <SkipCompiler Value="True"/>
       <SkipCompiler Value="True"/>

+ 1 - 1
packages/rtl/strutils.pas

@@ -484,7 +484,7 @@ var
       Result:=0;
       Result:=0;
   end;
   end;
 
 
-  function IsNumber(ch: char): boolean;
+  function IsNumber(ch: char): boolean; overload;
   begin
   begin
     Result := ch in ['0'..'9'];
     Result := ch in ['0'..'9'];
   end;
   end;

+ 1 - 1
packages/rtl/sysutils.pas

@@ -592,7 +592,7 @@ function Supports(const AClass: TClass; const IID: TGuidString): Boolean; overlo
 
 
 function TryStringToGUID(const s: string; out Guid: TGuid): Boolean;
 function TryStringToGUID(const s: string; out Guid: TGuid): Boolean;
 function StringToGUID(const S: string): TGuid;
 function StringToGUID(const S: string): TGuid;
-function GUIDToString(const guid: TGuid): string; reintroduce;
+function GUIDToString(const guid: TGuid): string;
 function IsEqualGUID(const guid1, guid2: TGuid): Boolean;
 function IsEqualGUID(const guid1, guid2: TGuid): Boolean;
 function GuidCase(const guid: TGuid; const List: array of TGuid): Integer;
 function GuidCase(const guid: TGuid; const List: array of TGuid): Integer;
 
 

+ 1 - 1
packages/rtl/webrouter.pp

@@ -67,7 +67,7 @@ Type
     function doGo(N: integer): TTransitionResult; virtual; abstract;
     function doGo(N: integer): TTransitionResult; virtual; abstract;
     procedure ensureURL (push : boolean = false); virtual; abstract;
     procedure ensureURL (push : boolean = false); virtual; abstract;
   Public
   Public
-    Constructor Create(aRouter : TRouter);
+    Constructor Create(aRouter : TRouter); reintroduce;
     Constructor Create(aRouter : TRouter; aBase : String); virtual;
     Constructor Create(aRouter : TRouter; aBase : String); virtual;
     Class Function NormalizeHash(aHash : String) : string;
     Class Function NormalizeHash(aHash : String) : string;
     Procedure UpdateRoute (aRoute : TRoute);
     Procedure UpdateRoute (aRoute : TRoute);