mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 04:59:20 +02:00
fcl-passrc: fixed a.specialize b<c>, creating tbinary as parent of tinlinespecializeexpr
git-svn-id: trunk@47242 -
This commit is contained in:
parent
42e48d016b
commit
20a8b05bee
@ -4729,14 +4729,6 @@ begin
|
|||||||
if not IsNameExpr(El) then exit;
|
if not IsNameExpr(El) then exit;
|
||||||
Parent:=El.Parent;
|
Parent:=El.Parent;
|
||||||
if Parent=nil then exit;
|
if Parent=nil then exit;
|
||||||
if Parent.ClassType=TBinaryExpr then
|
|
||||||
begin
|
|
||||||
Bin:=TBinaryExpr(Parent);
|
|
||||||
if (Bin.OpCode<>eopSubIdent) or (Bin.right<>El) then
|
|
||||||
exit;
|
|
||||||
El:=Bin;
|
|
||||||
Parent:=El.Parent;
|
|
||||||
end;
|
|
||||||
if Parent.ClassType=TInlineSpecializeExpr then
|
if Parent.ClassType=TInlineSpecializeExpr then
|
||||||
begin
|
begin
|
||||||
InlineSpec:=TInlineSpecializeExpr(Parent);
|
InlineSpec:=TInlineSpecializeExpr(Parent);
|
||||||
@ -4746,6 +4738,14 @@ begin
|
|||||||
Parent:=El.Parent;
|
Parent:=El.Parent;
|
||||||
if Parent=nil then exit;
|
if Parent=nil then exit;
|
||||||
end;
|
end;
|
||||||
|
if Parent.ClassType=TBinaryExpr then
|
||||||
|
begin
|
||||||
|
Bin:=TBinaryExpr(Parent);
|
||||||
|
if (Bin.OpCode<>eopSubIdent) or (Bin.right<>El) then
|
||||||
|
exit;
|
||||||
|
El:=Bin;
|
||||||
|
Parent:=El.Parent;
|
||||||
|
end;
|
||||||
if Parent.ClassType<>TParamsExpr then exit;
|
if Parent.ClassType<>TParamsExpr then exit;
|
||||||
Params:=TParamsExpr(Parent);
|
Params:=TParamsExpr(Parent);
|
||||||
if Params.Value<>El then exit;
|
if Params.Value<>El then exit;
|
||||||
|
@ -2541,21 +2541,36 @@ begin
|
|||||||
Expr:=Result;
|
Expr:=Result;
|
||||||
if Expr.Kind=pekBinary then
|
if Expr.Kind=pekBinary then
|
||||||
begin
|
begin
|
||||||
if Expr.OpCode<>eopSubIdent then
|
Bin:=TBinaryExpr(Expr);
|
||||||
|
if Bin.OpCode<>eopSubIdent then
|
||||||
ParseExcSyntaxError;
|
ParseExcSyntaxError;
|
||||||
Expr:=TBinaryExpr(Expr).right;
|
Expr:=Bin.right;
|
||||||
end;
|
end
|
||||||
|
else
|
||||||
|
Bin:=nil;
|
||||||
if Expr.Kind<>pekIdent then
|
if Expr.Kind<>pekIdent then
|
||||||
ParseExcSyntaxError;
|
ParseExcSyntaxError;
|
||||||
|
|
||||||
// read specialized params
|
// read specialized params
|
||||||
ISE:=TInlineSpecializeExpr(CreateElement(TInlineSpecializeExpr,'',AParent,SrcPos));
|
if Bin<>nil then
|
||||||
|
ISE:=TInlineSpecializeExpr(CreateElement(TInlineSpecializeExpr,'',Bin,SrcPos))
|
||||||
|
else
|
||||||
|
ISE:=TInlineSpecializeExpr(CreateElement(TInlineSpecializeExpr,'',AParent,SrcPos));
|
||||||
ReadSpecializeArguments(ISE,ISE.Params);
|
ReadSpecializeArguments(ISE,ISE.Params);
|
||||||
|
|
||||||
// A<B> or something.A<B>
|
// A<B> or something.A<B>
|
||||||
ISE.NameExpr:=Result;
|
ISE.NameExpr:=Expr;
|
||||||
Result.Parent:=ISE;
|
Expr.Parent:=ISE;
|
||||||
Result:=ISE;
|
if Bin<>nil then
|
||||||
|
begin
|
||||||
|
// something.A<B>
|
||||||
|
Bin.Right:=ISE;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
// A<B>
|
||||||
|
Result:=ISE;
|
||||||
|
end;
|
||||||
ISE:=nil;
|
ISE:=nil;
|
||||||
CanSpecialize:=aCannot;
|
CanSpecialize:=aCannot;
|
||||||
NextToken;
|
NextToken;
|
||||||
|
Loading…
Reference in New Issue
Block a user