diff --git a/packages/fcl-passrc/src/pasresolver.pp b/packages/fcl-passrc/src/pasresolver.pp index 263f804cc9..577db787f2 100644 --- a/packages/fcl-passrc/src/pasresolver.pp +++ b/packages/fcl-passrc/src/pasresolver.pp @@ -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; diff --git a/packages/fcl-passrc/src/pparser.pp b/packages/fcl-passrc/src/pparser.pp index c5bbf82569..768de3bf0a 100644 --- a/packages/fcl-passrc/src/pparser.pp +++ b/packages/fcl-passrc/src/pparser.pp @@ -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 or something.A - ISE.NameExpr:=Result; - Result.Parent:=ISE; - Result:=ISE; + ISE.NameExpr:=Expr; + Expr.Parent:=ISE; + if Bin<>nil then + begin + // something.A + Bin.Right:=ISE; + end + else + begin + // A + Result:=ISE; + end; ISE:=nil; CanSpecialize:=aCannot; NextToken;