mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 16:40:25 +02:00
pastojs: local var modifier absolute in method
git-svn-id: trunk@39977 -
This commit is contained in:
parent
7b3d35ad2f
commit
b019d40c64
@ -2850,14 +2850,13 @@ begin
|
|||||||
if ParentC=TProcedureBody then
|
if ParentC=TProcedureBody then
|
||||||
begin
|
begin
|
||||||
// local var
|
// local var
|
||||||
if (AbsIdent.Parent=El.Parent)
|
if (AbsIdent.Parent is TProcedureBody)
|
||||||
or ((AbsIdent is TPasArgument)
|
or (AbsIdent is TPasArgument) then
|
||||||
and (AbsIdent.Parent.Parent=El.Parent.Parent)) then
|
|
||||||
// ok
|
// ok
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{$IFDEF VerbosePas2JS}
|
{$IFDEF VerbosePas2JS}
|
||||||
writeln('TPas2JSResolver.FinishVariable absolute: Parent=',GetObjName(El.Parent),' AbsParent=',GetObjName(AbsIdent.Parent));
|
writeln('TPas2JSResolver.FinishVariable absolute: El.Parent=',GetObjName(El.Parent),'.Parent=',GetObjName(El.Parent.Parent),' AbsParent=',GetObjName(AbsIdent.Parent),'.Parent=',GetObjName(AbsIdent.Parent.Parent));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
RaiseMsg(20171226102424,nInvalidAbsoluteLocation,sInvalidAbsoluteLocation,[],El.AbsoluteExpr);
|
RaiseMsg(20171226102424,nInvalidAbsoluteLocation,sInvalidAbsoluteLocation,[],El.AbsoluteExpr);
|
||||||
end;
|
end;
|
||||||
|
@ -3829,16 +3829,25 @@ begin
|
|||||||
'type',
|
'type',
|
||||||
' TObject = class',
|
' TObject = class',
|
||||||
' Index: longint;',
|
' Index: longint;',
|
||||||
|
' procedure DoAbs(Item: pointer);',
|
||||||
' end;',
|
' end;',
|
||||||
'procedure DoIt(i: longint);',
|
'procedure TObject.DoAbs(Item: pointer);',
|
||||||
|
'var',
|
||||||
|
' o: TObject absolute Item;',
|
||||||
|
'begin',
|
||||||
|
' if o.Index<o.Index then o.Index:=o.Index;',
|
||||||
|
'end;',
|
||||||
|
'procedure DoIt(i: longint; p: pointer);',
|
||||||
'var',
|
'var',
|
||||||
' d: double absolute i;',
|
' d: double absolute i;',
|
||||||
' s: string absolute d;',
|
' s: string absolute d;',
|
||||||
' o: TObject absolute i;',
|
' oi: TObject absolute i;',
|
||||||
|
' op: TObject absolute p;',
|
||||||
'begin',
|
'begin',
|
||||||
' if d=d then d:=d;',
|
' if d=d then d:=d;',
|
||||||
' if s=s then s:=s;',
|
' if s=s then s:=s;',
|
||||||
' if o.Index<o.Index then o.Index:=o.Index;',
|
' if oi.Index<oi.Index then oi.Index:=oi.Index;',
|
||||||
|
' if op.Index=op.Index then op.Index:=op.Index;',
|
||||||
'end;',
|
'end;',
|
||||||
'begin']);
|
'begin']);
|
||||||
ConvertProgram;
|
ConvertProgram;
|
||||||
@ -3850,11 +3859,15 @@ begin
|
|||||||
' };',
|
' };',
|
||||||
' this.$final = function () {',
|
' this.$final = function () {',
|
||||||
' };',
|
' };',
|
||||||
|
' this.DoAbs = function (Item) {',
|
||||||
|
' if (Item.Index < Item.Index) Item.Index = Item.Index;',
|
||||||
|
' };',
|
||||||
'});',
|
'});',
|
||||||
'this.DoIt = function (i) {',
|
'this.DoIt = function (i, p) {',
|
||||||
' if (i === i) i = i;',
|
' if (i === i) i = i;',
|
||||||
' if (i === i) i = i;',
|
' if (i === i) i = i;',
|
||||||
' if (i.Index < i.Index) i.Index = i.Index;',
|
' if (i.Index < i.Index) i.Index = i.Index;',
|
||||||
|
' if (p.Index === p.Index) p.Index = p.Index;',
|
||||||
'};'
|
'};'
|
||||||
]),
|
]),
|
||||||
LinesToStr([
|
LinesToStr([
|
||||||
|
Loading…
Reference in New Issue
Block a user