mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-02 06:39:36 +01:00
codetools: fixed simple init
git-svn-id: trunk@29402 -
This commit is contained in:
parent
23861311a1
commit
8cd980cb5b
@ -919,6 +919,7 @@ var
|
||||
LazarusSrcDefines: TDefineTemplate;
|
||||
CurFPCOptions: String;
|
||||
UnitSetCache: TFPCUnitSetCache;
|
||||
//CfgCache: TFPCTargetConfigCache;
|
||||
|
||||
procedure AddFPCOption(s: string);
|
||||
begin
|
||||
@ -948,6 +949,11 @@ begin
|
||||
true);
|
||||
// parse compiler settings, fpc sources
|
||||
UnitSetCache.Init;
|
||||
//CfgCache:=UnitSetCache.GetConfigCache(false);
|
||||
//if CfgCache.TargetOS<>CfgCache.RealTargetOS then
|
||||
// debugln(['TCodeToolManager.Init TargetOS=',CfgCache.TargetOS,' RealTargetOS=',CfgCache.RealTargetOS]);
|
||||
//if CfgCache.TargetCPU<>CfgCache.RealTargetCPU then
|
||||
// debugln(['TCodeToolManager.Init TargetCPU=',CfgCache.TargetCPU,' RealTargetCPU=',CfgCache.RealTargetCPU]);
|
||||
|
||||
// create template for FPC settings
|
||||
FPCDefines:=CreateFPCTemplate(UnitSetCache,nil);
|
||||
@ -966,6 +972,9 @@ begin
|
||||
DefineTree.Add(DefinePool.CreateLCLProjectTemplate(
|
||||
'$(#LazarusSrcDir)','$(#LCLWidgetType)','$(#ProjectDir)',nil));
|
||||
|
||||
//debugln(['TCodeToolManager.Init defines: ',DefineTree.GetDefinesForVirtualDirectory.AsString]);
|
||||
//debugln(['TCodeToolManager.Init inc path rtl/system: ',GetIncludePathForDirectory(UnitSetCache.FPCSourceDirectory+'/rtl/bsd')]);
|
||||
|
||||
// save
|
||||
Config.ConfigCaches.Assign(FPCDefinesCache.ConfigCaches);
|
||||
Config.SourceCaches.Assign(FPCDefinesCache.SourceCaches);
|
||||
|
||||
@ -1779,7 +1779,11 @@ begin
|
||||
ctsFreePascalCompilerInitialMacros,'','',da_Block);
|
||||
|
||||
// define #TargetOS
|
||||
TargetOS:=Config.TargetOS;
|
||||
TargetOS:=Config.RealTargetOS;
|
||||
if TargetOS='' then
|
||||
TargetOS:=Config.TargetOS;
|
||||
if TargetOS='' then
|
||||
TargetOS:=GetCompiledTargetOS;
|
||||
NewDefTempl:=TDefineTemplate.Create('Define TargetOS',
|
||||
ctsDefaultFPCTargetOperatingSystem,
|
||||
ExternalMacroStart+'TargetOS',TargetOS,da_DefineRecurse);
|
||||
@ -1799,7 +1803,11 @@ begin
|
||||
ExternalMacroStart+'SrcOS2',SrcOS2,da_DefineRecurse);
|
||||
Result.AddChild(NewDefTempl);
|
||||
// define #TargetProcessor
|
||||
TargetCPU:=Config.TargetCPU;
|
||||
TargetCPU:=Config.RealTargetCPU;
|
||||
if TargetCPU='' then
|
||||
TargetCPU:=Config.TargetCPU;
|
||||
if TargetCPU='' then
|
||||
TargetCPU:=GetCompiledTargetCPU;
|
||||
NewDefTempl:=TDefineTemplate.Create('Define TargetProcessor',
|
||||
ctsDefaultFPCTargetProcessor,
|
||||
ExternalMacroStart+'TargetProcessor',TargetCPU,
|
||||
|
||||
@ -1939,18 +1939,24 @@ end;
|
||||
|
||||
function TExpressionEvaluator.AsString: string;
|
||||
var TxtLen, i, p: integer;
|
||||
s: String;
|
||||
begin
|
||||
TxtLen:=FCount*3;
|
||||
for i:=0 to FCount-1 do
|
||||
inc(TxtLen,length(FNames[i])+length(FValues[i]));
|
||||
TxtLen:=0;
|
||||
for i:=0 to FCount-1 do begin
|
||||
inc(TxtLen,length(FNames[i])+2);
|
||||
s:=FValues[i];
|
||||
if s<>'' then
|
||||
inc(TxtLen,length(s)+1);
|
||||
end;
|
||||
Setlength(Result,TxtLen);
|
||||
p:=1;
|
||||
for i:=0 to FCount-1 do begin
|
||||
Move(FNames[i][1],Result[p],length(FNames[i]));
|
||||
inc(p,length(FNames[i]));
|
||||
Result[p]:=' ';
|
||||
inc(p);
|
||||
if length(FValues[i])>0 then begin
|
||||
s:=FValues[i];
|
||||
if length(s)>0 then begin
|
||||
Result[p]:='=';
|
||||
inc(p);
|
||||
Move(FValues[i][1],Result[p],length(FValues[i]));
|
||||
inc(p,length(FValues[i]));
|
||||
end;
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
(i.e. at the moment: integer+integer=longint
|
||||
wanted: integer+integer=integer)
|
||||
- multi pass find declaration (i.e. searching with timeout)
|
||||
- Get and Set property access parameter lists
|
||||
- make @Proc context sensitive (started, but not complete)
|
||||
- operator overloading
|
||||
- ppu, dcu files
|
||||
@ -131,7 +130,7 @@ type
|
||||
function(Sender: TObject; const Filename: string): string of object;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
TOnGetMethodname = function(const AMethod: TMethod;
|
||||
TOnGetMethodName = function(const AMethod: TMethod;
|
||||
CheckOwner: TObject): string of object;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@ -275,7 +274,7 @@ type
|
||||
xtVariant, // variant
|
||||
xtNil // nil = pointer, class, procedure, method, ...
|
||||
);
|
||||
// Do not use this: TExpressionTypeDescs = set of TExpressionTypeDesc;
|
||||
// Do not define: TExpressionTypeDescs = set of TExpressionTypeDesc;
|
||||
// There are too many enums, so the set would be big and slow
|
||||
|
||||
const
|
||||
@ -609,6 +608,8 @@ type
|
||||
Params: TFindDeclarationParams): boolean;
|
||||
function FindIdentifierInRecordCase(RecordCaseNode: TCodeTreeNode;
|
||||
Params: TFindDeclarationParams): boolean;
|
||||
function FindIdentifierInTypeOfConstant(VarConstNode: TCodeTreeNode;
|
||||
Params: TFindDeclarationParams): boolean;
|
||||
protected
|
||||
WordIsPredefinedIdentifier: TKeyWordFunctionList;
|
||||
procedure RaiseUsesExpected;
|
||||
@ -2739,6 +2740,15 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
function SearchInConstant: boolean;
|
||||
// returns: true if ok to exit
|
||||
// false if search should continue
|
||||
begin
|
||||
Result:=false;
|
||||
if (ContextNode.Parent.Desc in [ctnVarDefinition,ctnConstDefinition]) then
|
||||
Result:=FindIdentifierInTypeOfConstant(ContextNode.Parent,Params);
|
||||
end;
|
||||
|
||||
function SearchInEnumDefinition: boolean;
|
||||
// returns: true if ok to exit
|
||||
// false if search should continue
|
||||
@ -3101,6 +3111,9 @@ begin
|
||||
ctnGlobalProperty, ctnGenericType:
|
||||
if SearchInTypeVarConstPropDefinition then exit;
|
||||
|
||||
ctnConstant:
|
||||
if SearchInConstant then exit;
|
||||
|
||||
ctnEnumIdentifier:
|
||||
if SearchInEnumDefinition then exit;
|
||||
|
||||
@ -5979,6 +5992,19 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFindDeclarationTool.FindIdentifierInTypeOfConstant(
|
||||
VarConstNode: TCodeTreeNode; Params: TFindDeclarationParams): boolean;
|
||||
{ const a: atype = context;
|
||||
for example: const p: TPoint = (x:0; y:0);
|
||||
}
|
||||
begin
|
||||
Result:=false;
|
||||
if VarConstNode.FirstChild=nil then exit;
|
||||
if VarConstNode.Desc=ctnIdentifier then begin
|
||||
debugln(['TFindDeclarationTool.FindIdentifierInTypeOfConstant ']);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFindDeclarationTool.RaiseUsesExpected;
|
||||
begin
|
||||
RaiseExceptionFmt(ctsStrExpectedButAtomFound,['"uses"',GetAtom]);
|
||||
|
||||
@ -3096,10 +3096,7 @@ begin
|
||||
ReadNextAtom; // name
|
||||
if CurPos.Flag=cafSemicolon then begin
|
||||
// ignore empty semicolons
|
||||
end else if AtomIsIdentifier(false)
|
||||
and ((not (Scanner.CompilerMode in [cmOBJFPC,cmFPC]))
|
||||
or (not UpAtomIs('PROPERTY')))
|
||||
then begin
|
||||
end else if AtomIsIdentifier(false) then begin
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnConstDefinition;
|
||||
ReadConst;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user