mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 01:29:21 +02:00
fcl-passrc: resolver: TPasIdentifierScope.GetLocalIdentifiers
git-svn-id: trunk@38159 -
This commit is contained in:
parent
33188fb5ba
commit
9fb9939464
@ -243,6 +243,13 @@ uses
|
|||||||
const
|
const
|
||||||
ParserMaxEmbeddedColumn = 2048;
|
ParserMaxEmbeddedColumn = 2048;
|
||||||
ParserMaxEmbeddedRow = $7fffffff div ParserMaxEmbeddedColumn;
|
ParserMaxEmbeddedRow = $7fffffff div ParserMaxEmbeddedColumn;
|
||||||
|
po_Resolver = [
|
||||||
|
po_ResolveStandardTypes,
|
||||||
|
po_NoOverloadedProcs,
|
||||||
|
po_KeepClassForward,
|
||||||
|
po_ArrayRangeExpr,
|
||||||
|
po_CheckModeswitches,
|
||||||
|
po_CheckCondFunction];
|
||||||
|
|
||||||
type
|
type
|
||||||
TResolverBaseType = (
|
TResolverBaseType = (
|
||||||
@ -569,6 +576,7 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
property Element: TPasElement read FElement write SetElement;
|
property Element: TPasElement read FElement write SetElement;
|
||||||
end;
|
end;
|
||||||
|
TPasIdentifierArray = array of TPasIdentifier;
|
||||||
|
|
||||||
{ TPasIdentifierScope - elements with a list of sub identifiers }
|
{ TPasIdentifierScope - elements with a list of sub identifiers }
|
||||||
|
|
||||||
@ -577,6 +585,7 @@ type
|
|||||||
FItems: TFPHashList;
|
FItems: TFPHashList;
|
||||||
procedure InternalAdd(Item: TPasIdentifier);
|
procedure InternalAdd(Item: TPasIdentifier);
|
||||||
procedure OnClearItem(Item, Dummy: pointer);
|
procedure OnClearItem(Item, Dummy: pointer);
|
||||||
|
procedure OnCollectItem(Item, List: pointer);
|
||||||
protected
|
protected
|
||||||
procedure OnWriteItem(Item, Dummy: pointer);
|
procedure OnWriteItem(Item, Dummy: pointer);
|
||||||
public
|
public
|
||||||
@ -595,6 +604,7 @@ type
|
|||||||
const OnIterateElement: TIterateScopeElement; Data: Pointer;
|
const OnIterateElement: TIterateScopeElement; Data: Pointer;
|
||||||
var Abort: boolean); override;
|
var Abort: boolean); override;
|
||||||
procedure WriteIdentifiers(Prefix: string); override;
|
procedure WriteIdentifiers(Prefix: string); override;
|
||||||
|
function GetLocalIdentifiers: TFPList; virtual;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TPasDefaultScope - root scope }
|
{ TPasDefaultScope - root scope }
|
||||||
@ -2679,6 +2689,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPasIdentifierScope.OnCollectItem(Item, List: pointer);
|
||||||
|
var
|
||||||
|
PasIdentifier: TPasIdentifier absolute Item;
|
||||||
|
FPList: TFPList absolute List;
|
||||||
|
begin
|
||||||
|
FPList.Add(PasIdentifier);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TPasIdentifierScope.OnWriteItem(Item, Dummy: pointer);
|
procedure TPasIdentifierScope.OnWriteItem(Item, Dummy: pointer);
|
||||||
var
|
var
|
||||||
PasIdentifier: TPasIdentifier absolute Item;
|
PasIdentifier: TPasIdentifier absolute Item;
|
||||||
@ -2874,6 +2892,12 @@ begin
|
|||||||
FItems.ForEachCall(@OnWriteItem,Pointer(Prefix));
|
FItems.ForEachCall(@OnWriteItem,Pointer(Prefix));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TPasIdentifierScope.GetLocalIdentifiers: TFPList;
|
||||||
|
begin
|
||||||
|
Result:=TFPList.Create;
|
||||||
|
FItems.ForEachCall(@OnCollectItem,Pointer(Result));
|
||||||
|
end;
|
||||||
|
|
||||||
{ TPasResolver }
|
{ TPasResolver }
|
||||||
|
|
||||||
// inline
|
// inline
|
||||||
@ -3539,9 +3563,7 @@ begin
|
|||||||
Clear;
|
Clear;
|
||||||
inherited SetCurrentParser(AValue);
|
inherited SetCurrentParser(AValue);
|
||||||
if CurrentParser<>nil then
|
if CurrentParser<>nil then
|
||||||
CurrentParser.Options:=CurrentParser.Options
|
CurrentParser.Options:=CurrentParser.Options+po_Resolver;
|
||||||
+[po_resolvestandardtypes,po_nooverloadedprocs,po_keepclassforward,
|
|
||||||
po_arrayrangeexpr,po_CheckModeswitches,po_CheckCondFunction];
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPasResolver.CheckTopScope(ExpectedClass: TPasScopeClass;
|
procedure TPasResolver.CheckTopScope(ExpectedClass: TPasScopeClass;
|
||||||
|
Loading…
Reference in New Issue
Block a user