mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 08:09:33 +02:00
pastojs: (f*f).helpercall
git-svn-id: trunk@41530 -
This commit is contained in:
parent
f71fac34fd
commit
2b9c7c7c78
@ -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}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user