mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 13:29:15 +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;
|
||||
Parent:=El.Parent;
|
||||
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
|
||||
begin
|
||||
InlineSpec:=TInlineSpecializeExpr(Parent);
|
||||
@ -4746,6 +4738,14 @@ begin
|
||||
Parent:=El.Parent;
|
||||
if Parent=nil then exit;
|
||||
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;
|
||||
Params:=TParamsExpr(Parent);
|
||||
if Params.Value<>El then exit;
|
||||
|
@ -2541,21 +2541,36 @@ begin
|
||||
Expr:=Result;
|
||||
if Expr.Kind=pekBinary then
|
||||
begin
|
||||
if Expr.OpCode<>eopSubIdent then
|
||||
Bin:=TBinaryExpr(Expr);
|
||||
if Bin.OpCode<>eopSubIdent then
|
||||
ParseExcSyntaxError;
|
||||
Expr:=TBinaryExpr(Expr).right;
|
||||
end;
|
||||
Expr:=Bin.right;
|
||||
end
|
||||
else
|
||||
Bin:=nil;
|
||||
if Expr.Kind<>pekIdent then
|
||||
ParseExcSyntaxError;
|
||||
|
||||
// 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);
|
||||
|
||||
// A<B> or something.A<B>
|
||||
ISE.NameExpr:=Result;
|
||||
Result.Parent:=ISE;
|
||||
Result:=ISE;
|
||||
ISE.NameExpr:=Expr;
|
||||
Expr.Parent:=ISE;
|
||||
if Bin<>nil then
|
||||
begin
|
||||
// something.A<B>
|
||||
Bin.Right:=ISE;
|
||||
end
|
||||
else
|
||||
begin
|
||||
// A<B>
|
||||
Result:=ISE;
|
||||
end;
|
||||
ISE:=nil;
|
||||
CanSpecialize:=aCannot;
|
||||
NextToken;
|
||||
|
Loading…
Reference in New Issue
Block a user