mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 23:56:04 +02:00
codetools: code creation support in a parameter of procedure variables.
git-svn-id: trunk@50308 -
This commit is contained in:
parent
82018334bb
commit
fb34c4b45f
@ -2483,6 +2483,18 @@ begin
|
|||||||
MissingUnitName:='';
|
MissingUnitName:='';
|
||||||
if Params.NewNode=nil then exit;
|
if Params.NewNode=nil then exit;
|
||||||
//DebugLn('TCodeCompletionCodeTool.CompleteLocalVariableAsParameter Proc/PropNode=',Params.NewNode.DescAsString,' ',copy(Params.NewCodeTool.Src,Params.NewNode.StartPos,50));
|
//DebugLn('TCodeCompletionCodeTool.CompleteLocalVariableAsParameter Proc/PropNode=',Params.NewNode.DescAsString,' ',copy(Params.NewCodeTool.Src,Params.NewNode.StartPos,50));
|
||||||
|
|
||||||
|
if Params.NewNode.Desc=ctnVarDefinition then
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
ExprType:=Params.NewCodeTool.ConvertNodeToExpressionType(Params.NewNode,Params);
|
||||||
|
if (ExprType.Desc=xtContext) and (ExprType.Context.Node<>nil) then begin
|
||||||
|
Params.NewCodeTool:=ExprType.Context.Tool;
|
||||||
|
Params.NewNode:=ExprType.Context.Node;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
end;
|
||||||
|
end;
|
||||||
ParameterNode:=Params.NewCodeTool.FindNthParameterNode(Params.NewNode,
|
ParameterNode:=Params.NewCodeTool.FindNthParameterNode(Params.NewNode,
|
||||||
ParameterIndex);
|
ParameterIndex);
|
||||||
if (ParameterNode=nil)
|
if (ParameterNode=nil)
|
||||||
|
@ -10874,7 +10874,7 @@ begin
|
|||||||
{$IFDEF CheckNodeTool}CheckNodeTool(Node);{$ENDIF}
|
{$IFDEF CheckNodeTool}CheckNodeTool(Node);{$ENDIF}
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
if Node=nil then exit;
|
if Node=nil then exit;
|
||||||
if Node.Desc in [ctnProcedure] then begin
|
if Node.Desc in [ctnProcedure,ctnProcedureType] then begin
|
||||||
ProcNode:=Node;
|
ProcNode:=Node;
|
||||||
//DebugLn(' FindNthParameterNode ProcNode="',copy(Params.NewCodeTool.Src,ProcNode.StartPos,ProcNode.EndPos-ProcNode.StartPos),'"');
|
//DebugLn(' FindNthParameterNode ProcNode="',copy(Params.NewCodeTool.Src,ProcNode.StartPos,ProcNode.EndPos-ProcNode.StartPos),'"');
|
||||||
FunctionNode:=nil;
|
FunctionNode:=nil;
|
||||||
|
@ -5820,7 +5820,7 @@ procedure TPascalParserTool.BuildSubTreeForProcHead(ProcNode: TCodeTreeNode;
|
|||||||
begin
|
begin
|
||||||
if ProcNode.Desc=ctnProcedureHead then
|
if ProcNode.Desc=ctnProcedureHead then
|
||||||
ProcNode:=ProcNode.Parent;
|
ProcNode:=ProcNode.Parent;
|
||||||
if ProcNode.Desc<>ctnProcedure then
|
if not(ProcNode.Desc in [ctnProcedure,ctnProcedureType]) then
|
||||||
RaiseException('INTERNAL ERROR: TPascalParserTool.BuildSubTreeForProcHead with FunctionResult');
|
RaiseException('INTERNAL ERROR: TPascalParserTool.BuildSubTreeForProcHead with FunctionResult');
|
||||||
BuildSubTreeForProcHead(ProcNode);
|
BuildSubTreeForProcHead(ProcNode);
|
||||||
FunctionResult:=ProcNode.FirstChild.FirstChild;
|
FunctionResult:=ProcNode.FirstChild.FirstChild;
|
||||||
|
Loading…
Reference in New Issue
Block a user