mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-04 16:23:53 +02:00
codetools: fixed find declaration multidim[,].sub
git-svn-id: trunk@61962 -
This commit is contained in:
parent
fc24b68aa6
commit
79aa478b8d
@ -8801,29 +8801,19 @@ var
|
|||||||
FirstParamStartPos: Integer;
|
FirstParamStartPos: Integer;
|
||||||
FirstParamProcContext: TFindContext;
|
FirstParamProcContext: TFindContext;
|
||||||
|
|
||||||
procedure RaiseIdentExpected;
|
procedure RaiseIdentExpected(const Id: int64);
|
||||||
begin
|
begin
|
||||||
RaiseExceptionFmt(20170421200530,ctsStrExpectedButAtomFound,[ctsIdentifier,GetAtom]);
|
RaiseExceptionFmt(Id,ctsStrExpectedButAtomFound,[ctsIdentifier,GetAtom]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RaiseIdentNotFound;
|
procedure RaiseIllegalQualifierFound(const Id: int64);
|
||||||
begin
|
begin
|
||||||
RaiseExceptionFmt(20170421200532,ctsIdentifierNotFound,[GetAtom]);
|
RaiseExceptionFmt(Id,ctsIllegalQualifier,[GetAtom]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RaiseIllegalQualifierFound;
|
procedure RaisePointNotFound(const Id: int64);
|
||||||
begin
|
begin
|
||||||
RaiseExceptionFmt(20170421200535,ctsIllegalQualifier,[GetAtom]);
|
RaiseExceptionFmt(Id,ctsStrExpectedButAtomFound,['.',GetAtom]);
|
||||||
end;
|
|
||||||
|
|
||||||
procedure RaisePointNotFound;
|
|
||||||
begin
|
|
||||||
RaiseExceptionFmt(20170421200537,ctsStrExpectedButAtomFound,['.',GetAtom]);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure RaiseClassDeclarationNotFound(Tool: TFindDeclarationTool);
|
|
||||||
begin
|
|
||||||
Tool.RaiseExceptionFmt(20170421200539,ctsClassSNotFound, [Tool.GetAtom]);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function InitAtomQueue: boolean;
|
function InitAtomQueue: boolean;
|
||||||
@ -9687,7 +9677,7 @@ var
|
|||||||
begin
|
begin
|
||||||
MoveCursorToCleanPos(NextAtom.StartPos);
|
MoveCursorToCleanPos(NextAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseIdentExpected;
|
RaiseIdentExpected(20191003163224);
|
||||||
end;
|
end;
|
||||||
ResolveChildren;
|
ResolveChildren;
|
||||||
if ExprType.Desc in xtAllTypeHelperTypes then begin
|
if ExprType.Desc in xtAllTypeHelperTypes then begin
|
||||||
@ -9695,7 +9685,7 @@ var
|
|||||||
end else if (ExprType.Context.Node=nil) then begin
|
end else if (ExprType.Context.Node=nil) then begin
|
||||||
MoveCursorToCleanPos(CurAtom.StartPos);
|
MoveCursorToCleanPos(CurAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseIllegalQualifierFound;
|
RaiseIllegalQualifierFound(20191003163056);
|
||||||
end else if ExprType.Context.Node.Desc in AllPointContexts then begin
|
end else if ExprType.Context.Node.Desc in AllPointContexts then begin
|
||||||
// ok, allowed
|
// ok, allowed
|
||||||
end else begin
|
end else begin
|
||||||
@ -9703,7 +9693,7 @@ var
|
|||||||
//debugln(['ResolvePoint ',ExprTypeToString(ExprType)]);
|
//debugln(['ResolvePoint ',ExprTypeToString(ExprType)]);
|
||||||
MoveCursorToCleanPos(CurAtom.StartPos);
|
MoveCursorToCleanPos(CurAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseIllegalQualifierFound;
|
RaiseIllegalQualifierFound(20191003163059);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -9714,7 +9704,7 @@ var
|
|||||||
begin
|
begin
|
||||||
MoveCursorToCleanPos(NextAtom.StartPos);
|
MoveCursorToCleanPos(NextAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseIdentExpected;
|
RaiseIdentExpected(20191003163227);
|
||||||
end;
|
end;
|
||||||
// 'as' is a type cast, so the left side is irrelevant
|
// 'as' is a type cast, so the left side is irrelevant
|
||||||
// -> context is default context
|
// -> context is default context
|
||||||
@ -9738,7 +9728,7 @@ var
|
|||||||
then begin
|
then begin
|
||||||
MoveCursorToCleanPos(NextAtom.StartPos);
|
MoveCursorToCleanPos(NextAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseIllegalQualifierFound;
|
RaiseIllegalQualifierFound(20191003163101);
|
||||||
end;
|
end;
|
||||||
ResolveBaseTypeOfIdentifier;
|
ResolveBaseTypeOfIdentifier;
|
||||||
if (ExprType.Desc=xtPointer) then begin
|
if (ExprType.Desc=xtPointer) then begin
|
||||||
@ -9753,7 +9743,7 @@ var
|
|||||||
then begin
|
then begin
|
||||||
MoveCursorToCleanPos(NextAtom.StartPos);
|
MoveCursorToCleanPos(NextAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaisePointNotFound;
|
RaisePointNotFound(20191003163249);
|
||||||
end;
|
end;
|
||||||
if (ExprType.Context.Node=nil)
|
if (ExprType.Context.Node=nil)
|
||||||
or (ExprType.Context.Node.Desc<>ctnPointerType) then begin
|
or (ExprType.Context.Node.Desc<>ctnPointerType) then begin
|
||||||
@ -9781,17 +9771,13 @@ var
|
|||||||
7. string character e.g. string[3]
|
7. string character e.g. string[3]
|
||||||
}
|
}
|
||||||
|
|
||||||
procedure RaiseTypeIdentNotFound;
|
procedure RaiseIdentInCurContextNotFound(const Id: int64);
|
||||||
begin
|
begin
|
||||||
ExprType.Context.Tool.RaiseExceptionFmt(20170421200553,ctsStrExpectedButAtomFound,
|
ExprType.Context.Tool.RaiseExceptionFmt(Id,ctsStrExpectedButAtomFound,
|
||||||
[ctsTypeIdentifier,ExprType.Context.Tool.GetAtom]);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure RaiseIdentInCurContextNotFound;
|
|
||||||
begin
|
|
||||||
ExprType.Context.Tool.RaiseExceptionFmt(20170421200557,ctsStrExpectedButAtomFound,
|
|
||||||
[ctsIdentifier,GetAtom]);
|
[ctsIdentifier,GetAtom]);
|
||||||
end;
|
end;
|
||||||
|
var
|
||||||
|
LastAtomPos: TAtomPosition;
|
||||||
begin
|
begin
|
||||||
{$IFDEF ShowExprEval}
|
{$IFDEF ShowExprEval}
|
||||||
debugln([' FindExpressionTypeOfTerm ResolveEdgedBracketOpen ',ExprTypeToString(ExprType)]);
|
debugln([' FindExpressionTypeOfTerm ResolveEdgedBracketOpen ',ExprTypeToString(ExprType)]);
|
||||||
@ -9805,7 +9791,7 @@ var
|
|||||||
then begin
|
then begin
|
||||||
MoveCursorToCleanPos(NextAtom.StartPos);
|
MoveCursorToCleanPos(NextAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseIllegalQualifierFound;
|
RaiseIllegalQualifierFound(20191003163104);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (ExprType.Desc=xtContext)
|
if (ExprType.Desc=xtContext)
|
||||||
@ -9838,7 +9824,7 @@ var
|
|||||||
if ExprType.Context.Node=nil then begin
|
if ExprType.Context.Node=nil then begin
|
||||||
MoveCursorToCleanPos(NextAtom.StartPos);
|
MoveCursorToCleanPos(NextAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseIllegalQualifierFound;
|
RaiseIllegalQualifierFound(20191003163107);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if ExprType.Context.Node.Desc in [ctnRangedArrayType,ctnOpenArrayType] then
|
if ExprType.Context.Node.Desc in [ctnRangedArrayType,ctnOpenArrayType] then
|
||||||
@ -9848,15 +9834,21 @@ var
|
|||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
repeat
|
repeat
|
||||||
case CurPos.Flag of
|
case CurPos.Flag of
|
||||||
cafRoundBracketClose: SaveRaiseBracketCloseExpectedButAtomFound(20170425090717);
|
cafRoundBracketClose: RaiseCharExpectedButAtomFound(20191003162217,']');
|
||||||
cafRoundBracketOpen,
|
cafRoundBracketOpen,
|
||||||
cafEdgedBracketOpen: ReadTilBracketClose(true);
|
cafEdgedBracketOpen: ReadTilBracketClose(true);
|
||||||
|
cafEdgedBracketClose: break;
|
||||||
cafComma:
|
cafComma:
|
||||||
with ExprType, Context do begin
|
with ExprType do begin
|
||||||
Context:=Tool.FindBaseTypeOfNode(Params,Node.LastChild);
|
LastAtomPos:=CurPos;
|
||||||
if not (Node.Desc in [ctnRangedArrayType,ctnOpenArrayType]) then
|
Context:=Context.Tool.FindBaseTypeOfNode(Params,Context.Node.LastChild);
|
||||||
RaiseIllegalQualifierFound;
|
if not (Context.Node.Desc in [ctnRangedArrayType,ctnOpenArrayType]) then
|
||||||
|
RaiseIllegalQualifierFound(20191003162513);
|
||||||
|
MoveCursorToAtomPos(LastAtomPos);
|
||||||
end;
|
end;
|
||||||
|
cafNone:
|
||||||
|
if CurPos.StartPos>SrcLen then
|
||||||
|
;
|
||||||
end;
|
end;
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
until CurPos.Flag=cafEdgedBracketClose;
|
until CurPos.Flag=cafEdgedBracketClose;
|
||||||
@ -9912,7 +9904,7 @@ var
|
|||||||
ctnProperty, ctnGlobalProperty:
|
ctnProperty, ctnGlobalProperty:
|
||||||
begin
|
begin
|
||||||
if not ExprType.Context.Tool.PropertyNodeHasParamList(ExprType.Context.Node) then
|
if not ExprType.Context.Tool.PropertyNodeHasParamList(ExprType.Context.Node) then
|
||||||
RaiseIdentInCurContextNotFound;
|
RaiseIdentInCurContextNotFound(20191003163359);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ctnIdentifier:
|
ctnIdentifier:
|
||||||
@ -9931,14 +9923,14 @@ var
|
|||||||
end else begin
|
end else begin
|
||||||
MoveCursorToCleanPos(CurAtom.StartPos);
|
MoveCursorToCleanPos(CurAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseIllegalQualifierFound;
|
RaiseIllegalQualifierFound(20191003163124);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
else
|
else
|
||||||
MoveCursorToCleanPos(CurAtom.StartPos);
|
MoveCursorToCleanPos(CurAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseIllegalQualifierFound;
|
RaiseIllegalQualifierFound(20191003163127);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -9954,7 +9946,7 @@ var
|
|||||||
begin
|
begin
|
||||||
MoveCursorToCleanPos(NextAtom.StartPos);
|
MoveCursorToCleanPos(NextAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseIllegalQualifierFound;
|
RaiseIllegalQualifierFound(20191003163130);
|
||||||
end;
|
end;
|
||||||
if PrevAtomType<>vatNone then begin
|
if PrevAtomType<>vatNone then begin
|
||||||
// typecast or function
|
// typecast or function
|
||||||
@ -10012,7 +10004,7 @@ var
|
|||||||
|
|
||||||
if (Context.Node<>StartNode) or (Context.Node=nil) then begin
|
if (Context.Node<>StartNode) or (Context.Node=nil) then begin
|
||||||
MoveCursorToCleanPos(CurAtom.StartPos);
|
MoveCursorToCleanPos(CurAtom.StartPos);
|
||||||
RaiseIllegalQualifierFound;
|
RaiseIllegalQualifierFound(20191003163133);
|
||||||
end;
|
end;
|
||||||
ProcNode:=GetMethodOfBody(Context.Node);
|
ProcNode:=GetMethodOfBody(Context.Node);
|
||||||
if ProcNode=nil then begin
|
if ProcNode=nil then begin
|
||||||
@ -10025,7 +10017,7 @@ var
|
|||||||
begin
|
begin
|
||||||
MoveCursorToCleanPos(NextAtom.StartPos);
|
MoveCursorToCleanPos(NextAtom.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseIdentExpected;
|
RaiseIdentExpected(20191003163231);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ReadNextExpressionAtom;
|
ReadNextExpressionAtom;
|
||||||
|
Loading…
Reference in New Issue
Block a user