mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 02:09:14 +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
|
||||
begin
|
||||
// local var
|
||||
if (AbsIdent.Parent=El.Parent)
|
||||
or ((AbsIdent is TPasArgument)
|
||||
and (AbsIdent.Parent.Parent=El.Parent.Parent)) then
|
||||
if (AbsIdent.Parent is TProcedureBody)
|
||||
or (AbsIdent is TPasArgument) then
|
||||
// ok
|
||||
else
|
||||
begin
|
||||
{$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}
|
||||
RaiseMsg(20171226102424,nInvalidAbsoluteLocation,sInvalidAbsoluteLocation,[],El.AbsoluteExpr);
|
||||
end;
|
||||
|
@ -3829,16 +3829,25 @@ begin
|
||||
'type',
|
||||
' TObject = class',
|
||||
' Index: longint;',
|
||||
' procedure DoAbs(Item: pointer);',
|
||||
' 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',
|
||||
' d: double absolute i;',
|
||||
' s: string absolute d;',
|
||||
' o: TObject absolute i;',
|
||||
' oi: TObject absolute i;',
|
||||
' op: TObject absolute p;',
|
||||
'begin',
|
||||
' if d=d then d:=d;',
|
||||
' 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;',
|
||||
'begin']);
|
||||
ConvertProgram;
|
||||
@ -3850,11 +3859,15 @@ begin
|
||||
' };',
|
||||
' 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.Index < i.Index) i.Index = i.Index;',
|
||||
' if (p.Index === p.Index) p.Index = p.Index;',
|
||||
'};'
|
||||
]),
|
||||
LinesToStr([
|
||||
|
Loading…
Reference in New Issue
Block a user