pas2js: merged handling of (i*i).helperfunc

This commit is contained in:
mattias 2020-04-26 20:51:44 +00:00
parent 5e22bdf07d
commit f874a25f75
2 changed files with 17 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{
This file is part of the Free Component Library (FCL)
Copyright (c) 2018 by Michael Van Canneyt
Copyright (c) 2020 by Michael Van Canneyt
Pascal to Javascript converter class.
@ -6798,6 +6798,7 @@ var
ModeSwitches: TModeSwitches;
aResolver: TPas2JSResolver;
LeftTypeEl, RightTypeEl: TPasType;
OldAccess: TCtxAccess;
begin
Result:=Nil;
aResolver:=AContext.Resolver;
@ -6816,14 +6817,8 @@ begin
end;
end;
if AContext.Access<>caRead then
begin
{$IFDEF VerbosePas2JS}
writeln('TPasToJSConverter.ConvertBinaryExpression OpCode=',El.OpCode,' AContext.Access=',AContext.Access);
{$ENDIF}
DoError(20170209152633,nVariableIdentifierExpected,sVariableIdentifierExpected,[],El);
end;
OldAccess:=AContext.Access;
AContext.Access:=caRead;
Call:=nil;
A:=ConvertExpression(El.left,AContext);
B:=nil;
@ -7065,6 +7060,7 @@ begin
end;
finally
AContext.Access:=OldAccess;
if Result=nil then
begin
A.Free;
@ -21638,10 +21634,17 @@ begin
end
else
begin
{$IFDEF VerbosePas2JS}
writeln('TPasToJSConverter.CreateProcCallArgRef FullGetter=',GetObjName(FullGetter),' Setter=',GetObjName(ParamContext.Setter));
{$ENDIF}
RaiseNotSupported(El,AContext,20170213230336);
// getter is the result of an operation
// create "p:FullGetter"
AddVar(TempRefParamName,FullGetter);
FullGetter:=nil;
// GetExpr "this.a"
GetExpr:=CreatePrimitiveDotExpr('this.'+TempRefParamName,El);
// SetExpr "raise EPropReadOnly"
SetExpr:=CreateRaisePropReadOnly(El);
end;
{$IFDEF VerbosePas2JS}

View File

@ -23493,7 +23493,7 @@ begin
'begin',
' DoIt(i.toStr);',
' DoIt(i.toStr());',
//' (i*i).toStr;',
' (i*i).toStr;',
' DoIt((i*i).toStr);',
'']);
ConvertProgram;