diff --git a/packages/pastojs/src/fppas2js.pp b/packages/pastojs/src/fppas2js.pp index b0b37b48c2..f40cf9ad53 100644 --- a/packages/pastojs/src/fppas2js.pp +++ b/packages/pastojs/src/fppas2js.pp @@ -6686,6 +6686,7 @@ var ModeSwitches: TModeSwitches; aResolver: TPas2JSResolver; LeftTypeEl, RightTypeEl: TPasType; + OldAccess: TCtxAccess; begin Result:=Nil; aResolver:=AContext.Resolver; @@ -6704,14 +6705,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; @@ -6942,6 +6937,7 @@ begin end; end; finally + AContext.Access:=OldAccess; if Result=nil then begin A.Free; @@ -21610,6 +21606,7 @@ begin ParamContext.Arg:=TargetArg; ParamContext.Expr:=El; ParamContext.ResolvedExpr:=ResolvedEl; + writeln('AAA1 TPasToJSConverter.CreateProcCallArgRef ',GetObjName(El)); FullGetter:=ConvertExpression(El,ParamContext); // FullGetter is now a full JS expression to retrieve the value. if ParamContext.ReusingReference then @@ -21767,10 +21764,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} diff --git a/packages/pastojs/tests/tcmodules.pas b/packages/pastojs/tests/tcmodules.pas index 981aff4945..92f2a649cb 100644 --- a/packages/pastojs/tests/tcmodules.pas +++ b/packages/pastojs/tests/tcmodules.pas @@ -22915,6 +22915,8 @@ begin 'begin', ' DoIt(f.toStr);', ' DoIt(f.toStr());', + ' (f*f).toStr;', + ' DoIt((f*f).toStr);', '']); ConvertProgram; CheckSource('TestTypeHelper_Double', @@ -22949,6 +22951,24 @@ begin ' this.p.f = v;', ' }', '}));', + '$mod.THelper.ToStr.call({', + ' a: $mod.f * $mod.f,', + ' get: function () {', + ' return this.a;', + ' },', + ' set: function (v) {', + ' rtl.raiseE("EPropReadOnly");', + ' }', + '});', + '$mod.DoIt($mod.THelper.ToStr.call({', + ' a: $mod.f * $mod.f,', + ' get: function () {', + ' return this.a;', + ' },', + ' set: function (v) {', + ' rtl.raiseE("EPropReadOnly");', + ' }', + '}));', ''])); end;