mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 17:19:19 +02:00
IDE: codecontext: added string[]
git-svn-id: trunk@25528 -
This commit is contained in:
parent
eb60223ce2
commit
0a5e197f49
@ -643,8 +643,6 @@ type
|
|||||||
function FindExpressionTypeOfTerm(StartPos, EndPos: integer;
|
function FindExpressionTypeOfTerm(StartPos, EndPos: integer;
|
||||||
Params: TFindDeclarationParams; WithAsOperator: boolean): TExpressionType;
|
Params: TFindDeclarationParams; WithAsOperator: boolean): TExpressionType;
|
||||||
function FindEndOfExpression(StartPos: integer): integer;
|
function FindEndOfExpression(StartPos: integer): integer;
|
||||||
function ConvertNodeToExpressionType(Node: TCodeTreeNode;
|
|
||||||
Params: TFindDeclarationParams): TExpressionType;
|
|
||||||
function ReadOperandTypeAtCursor(
|
function ReadOperandTypeAtCursor(
|
||||||
Params: TFindDeclarationParams; MaxEndPos: integer = -1): TExpressionType;
|
Params: TFindDeclarationParams; MaxEndPos: integer = -1): TExpressionType;
|
||||||
function FindExpressionTypeOfPredefinedIdentifier(StartPos: integer;
|
function FindExpressionTypeOfPredefinedIdentifier(StartPos: integer;
|
||||||
@ -801,6 +799,8 @@ type
|
|||||||
function BaseTypeOfNodeHasSubIdents(ANode: TCodeTreeNode): boolean;
|
function BaseTypeOfNodeHasSubIdents(ANode: TCodeTreeNode): boolean;
|
||||||
function FindBaseTypeOfNode(Params: TFindDeclarationParams;
|
function FindBaseTypeOfNode(Params: TFindDeclarationParams;
|
||||||
Node: TCodeTreeNode): TFindContext;
|
Node: TCodeTreeNode): TFindContext;
|
||||||
|
function ConvertNodeToExpressionType(Node: TCodeTreeNode;
|
||||||
|
Params: TFindDeclarationParams): TExpressionType;
|
||||||
|
|
||||||
function FindDeclarationAndOverload(const CursorPos: TCodeXYPosition;
|
function FindDeclarationAndOverload(const CursorPos: TCodeXYPosition;
|
||||||
out ListOfPCodeXYPosition: TFPList;
|
out ListOfPCodeXYPosition: TFPList;
|
||||||
|
@ -1760,6 +1760,7 @@ begin
|
|||||||
else
|
else
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
//DebugLn(['TIdentCompletionTool.CollectAllContexts add ',FoundContext.Node.DescAsString]);
|
||||||
AddCollectionContext(FoundContext.Tool,FoundContext.Node);
|
AddCollectionContext(FoundContext.Tool,FoundContext.Node);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2208,7 +2209,7 @@ var
|
|||||||
if not StartInSubContext then
|
if not StartInSubContext then
|
||||||
Include(Params.Flags,fdfSearchInParentNodes);
|
Include(Params.Flags,fdfSearchInParentNodes);
|
||||||
CurrentIdentifierList.Context:=GatherContext;
|
CurrentIdentifierList.Context:=GatherContext;
|
||||||
//DebugLn('CheckContextIsParameter searching procedure ...');
|
//DebugLn('CheckContextIsParameter searching procedures, properties and variables ...');
|
||||||
GatherContext.Tool.FindIdentifierInContext(Params);
|
GatherContext.Tool.FindIdentifierInContext(Params);
|
||||||
//DebugLn('CheckContextIsParameter END');
|
//DebugLn('CheckContextIsParameter END');
|
||||||
Ok:=true;
|
Ok:=true;
|
||||||
|
@ -105,6 +105,7 @@ begin
|
|||||||
if CodeContextFrm = nil then
|
if CodeContextFrm = nil then
|
||||||
CodeContextFrm := TCodeContextFrm.Create(nil);
|
CodeContextFrm := TCodeContextFrm.Create(nil);
|
||||||
CodeContextFrm.SetCodeContexts(CodeContexts);
|
CodeContextFrm.SetCodeContexts(CodeContexts);
|
||||||
|
|
||||||
CodeContextFrm.Visible := True;
|
CodeContextFrm.Visible := True;
|
||||||
Result := True;
|
Result := True;
|
||||||
finally
|
finally
|
||||||
@ -294,24 +295,33 @@ procedure TCodeContextFrm.CreateHints(const CodeContexts: TCodeContextInfo);
|
|||||||
function FindBaseType(Tool: TFindDeclarationTool; Node: TCodeTreeNode;
|
function FindBaseType(Tool: TFindDeclarationTool; Node: TCodeTreeNode;
|
||||||
var s: string): boolean;
|
var s: string): boolean;
|
||||||
var
|
var
|
||||||
Context: TFindContext;
|
Expr: TExpressionType;
|
||||||
Params: TFindDeclarationParams;
|
Params: TFindDeclarationParams;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
Params:=TFindDeclarationParams.Create;
|
Params:=TFindDeclarationParams.Create;
|
||||||
try
|
try
|
||||||
try
|
try
|
||||||
Context:=Tool.FindBaseTypeOfNode(Params,Node);
|
Expr:=Tool.ConvertNodeToExpressionType(Node,Params);
|
||||||
if Context.Node=nil then exit;
|
if (Expr.Desc=xtContext) and (Expr.Context.Node<>nil) then begin
|
||||||
case Context.Node.Desc of
|
case Expr.Context.Node.Desc of
|
||||||
ctnProcedureType:
|
ctnProcedureType:
|
||||||
begin
|
begin
|
||||||
s:=s+Context.Tool.ExtractProcHead(Context.Node,
|
s:=s+Expr.Context.Tool.ExtractProcHead(Expr.Context.Node,
|
||||||
[phpWithVarModifiers,phpWithParameterNames,phpWithDefaultValues,
|
[phpWithVarModifiers,phpWithParameterNames,phpWithDefaultValues,
|
||||||
phpWithResultType]);
|
phpWithResultType]);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end else if Expr.Desc in (xtAllStringTypes+xtAllWideStringTypes-[xtShortString])
|
||||||
|
then begin
|
||||||
|
s:=s+'[1..high(PtrUInt)]';
|
||||||
|
Result:=true;
|
||||||
|
end else if Expr.Desc=xtShortString then begin
|
||||||
|
s:=s+'[0..255]';
|
||||||
|
Result:=true;
|
||||||
|
end else
|
||||||
|
debugln(['FindBaseType ',ExprTypeToString(Expr)]);
|
||||||
except
|
except
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
|
Loading…
Reference in New Issue
Block a user