27.10.2011 18:36, Sven Barth пишет:
Show quoted text 41 lines
Am 27.10.2011 16:19, schrieb Alexander Shishkin:
> 27.10.2011 17:40, Jonas Maebe пишет:
>>
>> On 27 Oct 2011, at 15:26, Alexander Shishkin wrote:
>>
>>> I`ve got this with 2.5.1 & 2.7.1
>>>
>>> 1) unable to clean reproduce (real code is
>>>
https://github.com/alexvins/dwscript/tree/628669df8fd349968e7498ab1da617be6c4f3977)
>>>
>>>
>>>
>>> 2) error reported in the middle of EMPTY line.
>>
>> This internal error indicates that a problem occurred while generating
>> code for a specialization of a generic. This code generation does not
>> happen when the specialization is declared, but only after all the code
>> in the unit has been compiled. That's why you get a bogus error
>> location.
>>
>>> 3) no ideas how to to make workaround
>>
>> Me neither, except for not using generics at all (or disabling your
>> specializations one by one to figure out which one triggers the
>> problem).
>>
>>
> I found problematic place. BTW the compiler internal error line&col
> position was right, but unit name was wrong.
It would be nice if you'd mention line, column, incorrect unitname and
correct unitname. Then I might be able to help you ;)
Regards,
Sven
_______________________________________________
fpc-devel maillist -
http://lists.freepascal.org/mailman/listinfo/fpc-devel
Wrong message:
...\Source\dwsSymbols.pas(264,20) Fatal: Internal error 200512115 Real place:
\Source\dwsUtils.pas(263,20)
Patch for workaround:
Source/dwsUtils.pas | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/Source/dwsUtils.pas b/Source/dwsUtils.pas index a733f57..89b7dbb 100644
--- a/Source/dwsUtils.pas
+++ b/Source/dwsUtils.pas
@@ -231,11 +231,17 @@ TSimpleHashBucket<T> = record
{: Minimalistic open-addressing hash, subclasses must override
SameItem and GetItemHashCode.
HashCodes *MUST* be non zero }
+
+ { TSimpleHash }
+
TSimpleHash<T> = class
{$IFDEF FPC}
private
type
THashBucket = TSimpleHashBucket<T>;
+ public
+ type
+ THashEnumProc = TSimpleHashProc<T>;
{$ENDIF}
private
{$IFDEF FPC}
@@ -260,7 +266,11 @@ TSimpleHash<T> = class
function Extract(const anItem : T) : Boolean; // true if
extracted
function Contains(const anItem : T) : Boolean;
function Match(var anItem : T) : Boolean;
+ {$IFDEF FPC}
+ procedure Enumerate(const callBack : THashEnumProc);
+ {$ELSE}
procedure Enumerate(const callBack : TSimpleHashProc<T>);
+ {$ENDIF}
procedure Clear;
property Count : Integer read FCount;
@@ -1535,24 +1545,27 @@ function TSimpleHash<T>.Match(var anItem : T) :
Boolean;
// Enumerate
//
-procedure TSimpleHash<T>.Enumerate(const callBack : TSimpleHashProc<T>);
+{$IFDEF FPC}
+procedure TSimpleHash<T>.Enumerate(const callBack: THashEnumProc);
var
i : Integer;
-{$IFDEF FPC}
_cb:TSimpleHashProc<T>; //TODO: remove ugly workaround
-{$ENDIF}
begin
- {$IFDEF FPC}
_cb := callBack;
for i:=0 to High(FBuckets) do
if FBuckets[i].HashCode0 then
_cb(FBuckets[i].Value);
- {$ELSE}
+end;
+{$ELSE}
+procedure TSimpleHash<T>.Enumerate(const callBack : TSimpleHashProc<T>);
+var
+ i : Integer;
+begin
for i:=0 to High(FBuckets) do
if FBuckets[i].HashCode0 then
callBack(FBuckets[i].Value);
- {$ENDIF}
end;
+{$ENDIF}
// Clear
//