|
@@ -8711,33 +8711,35 @@ var
|
|
aResolver:=AContext.Resolver;
|
|
aResolver:=AContext.Resolver;
|
|
Call:=nil;
|
|
Call:=nil;
|
|
try
|
|
try
|
|
|
|
+ // find getter/setter
|
|
case AContext.Access of
|
|
case AContext.Access of
|
|
caAssign:
|
|
caAssign:
|
|
- begin
|
|
|
|
AccessEl:=aResolver.GetPasPropertySetter(Prop);
|
|
AccessEl:=aResolver.GetPasPropertySetter(Prop);
|
|
- if IsJSBracketAccessorAndConvert(Prop,AccessEl,AContext,true) then
|
|
|
|
- exit;
|
|
|
|
- if aResolver.IsHelperMethod(AccessEl) then
|
|
|
|
- Call:=CreateCallHelperMethod(TPasProcedure(AccessEl),El.Value,AContext)
|
|
|
|
- else
|
|
|
|
- Call:=CreateCallExpression(El);
|
|
|
|
- AssignContext:=AContext.AccessContext as TAssignContext;
|
|
|
|
- AssignContext.PropertyEl:=Prop;
|
|
|
|
- AssignContext.Call:=Call;
|
|
|
|
- end;
|
|
|
|
caRead:
|
|
caRead:
|
|
- begin
|
|
|
|
AccessEl:=aResolver.GetPasPropertyGetter(Prop);
|
|
AccessEl:=aResolver.GetPasPropertyGetter(Prop);
|
|
- if IsJSBracketAccessorAndConvert(Prop,AccessEl,AContext,true) then
|
|
|
|
- exit;
|
|
|
|
- if aResolver.IsHelperMethod(AccessEl) then
|
|
|
|
|
|
+ else
|
|
|
|
+ RaiseNotSupported(El,AContext,20170213213317);
|
|
|
|
+ end;
|
|
|
|
+ if IsJSBracketAccessorAndConvert(Prop,AccessEl,AContext,true) then
|
|
|
|
+ exit;
|
|
|
|
+
|
|
|
|
+ // create call
|
|
|
|
+ if aResolver.IsHelperMethod(AccessEl) then
|
|
|
|
+ begin
|
|
|
|
+ if CheckPath then
|
|
Call:=CreateCallHelperMethod(TPasProcedure(AccessEl),El.Value,AContext)
|
|
Call:=CreateCallHelperMethod(TPasProcedure(AccessEl),El.Value,AContext)
|
|
else
|
|
else
|
|
- Call:=CreateCallExpression(El);
|
|
|
|
|
|
+ Call:=CreateCallHelperMethod(TPasProcedure(AccessEl),El,AContext)
|
|
end
|
|
end
|
|
else
|
|
else
|
|
- RaiseNotSupported(El,AContext,20170213213317);
|
|
|
|
- end;
|
|
|
|
|
|
+ Call:=CreateCallExpression(El);
|
|
|
|
+
|
|
|
|
+ if AContext.Access=caAssign then
|
|
|
|
+ begin
|
|
|
|
+ AssignContext:=AContext.AccessContext as TAssignContext;
|
|
|
|
+ AssignContext.PropertyEl:=Prop;
|
|
|
|
+ AssignContext.Call:=Call;
|
|
|
|
+ end;
|
|
|
|
|
|
if CheckPath and (Call.Expr=nil) then
|
|
if CheckPath and (Call.Expr=nil) then
|
|
if aResolver.IsNameExpr(El.Value) then
|
|
if aResolver.IsNameExpr(El.Value) then
|
|
@@ -8839,27 +8841,29 @@ var
|
|
Left, Right: TJSElement;
|
|
Left, Right: TJSElement;
|
|
OldAccess: TCtxAccess;
|
|
OldAccess: TCtxAccess;
|
|
AccessEl, SetAccessEl: TPasElement;
|
|
AccessEl, SetAccessEl: TPasElement;
|
|
|
|
+ aResolver: TPas2JSResolver;
|
|
begin
|
|
begin
|
|
|
|
+ aResolver:=AContext.Resolver;
|
|
case AContext.Access of
|
|
case AContext.Access of
|
|
caAssign:
|
|
caAssign:
|
|
begin
|
|
begin
|
|
- AccessEl:=AContext.Resolver.GetPasPropertySetter(Prop);
|
|
|
|
|
|
+ AccessEl:=aResolver.GetPasPropertySetter(Prop);
|
|
if IsJSBracketAccessorAndConvert(Prop,AccessEl,AContext,false) then
|
|
if IsJSBracketAccessorAndConvert(Prop,AccessEl,AContext,false) then
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
caRead:
|
|
caRead:
|
|
begin
|
|
begin
|
|
- AccessEl:=AContext.Resolver.GetPasPropertyGetter(Prop);
|
|
|
|
|
|
+ AccessEl:=aResolver.GetPasPropertyGetter(Prop);
|
|
if IsJSBracketAccessorAndConvert(Prop,AccessEl,AContext,false) then
|
|
if IsJSBracketAccessorAndConvert(Prop,AccessEl,AContext,false) then
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
caByReference:
|
|
caByReference:
|
|
begin
|
|
begin
|
|
- AccessEl:=AContext.Resolver.GetPasPropertyGetter(Prop);
|
|
|
|
- SetAccessEl:=AContext.Resolver.GetPasPropertySetter(Prop);
|
|
|
|
- if AContext.Resolver.IsExternalBracketAccessor(AccessEl) then
|
|
|
|
|
|
+ AccessEl:=aResolver.GetPasPropertyGetter(Prop);
|
|
|
|
+ SetAccessEl:=aResolver.GetPasPropertySetter(Prop);
|
|
|
|
+ if aResolver.IsExternalBracketAccessor(AccessEl) then
|
|
begin
|
|
begin
|
|
- if AContext.Resolver.IsExternalBracketAccessor(SetAccessEl) then
|
|
|
|
|
|
+ if aResolver.IsExternalBracketAccessor(SetAccessEl) then
|
|
begin
|
|
begin
|
|
// read and write are brackets -> easy
|
|
// read and write are brackets -> easy
|
|
if not IsJSBracketAccessorAndConvert(Prop,AccessEl,AContext,false) then
|
|
if not IsJSBracketAccessorAndConvert(Prop,AccessEl,AContext,false) then
|
|
@@ -8873,6 +8877,12 @@ var
|
|
RaiseNotSupported(El,AContext,20170402233834);
|
|
RaiseNotSupported(El,AContext,20170402233834);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ if aResolver.IsHelperMethod(AccessEl) then
|
|
|
|
+ begin
|
|
|
|
+ ConvertIndexedProperty(Prop,AContext,false);
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
|
|
+
|
|
DotContext:=nil;
|
|
DotContext:=nil;
|
|
Left:=nil;
|
|
Left:=nil;
|
|
Right:=nil;
|
|
Right:=nil;
|
|
@@ -16977,6 +16987,7 @@ begin
|
|
SelfScope:=nil;
|
|
SelfScope:=nil;
|
|
PosEl:=Expr;
|
|
PosEl:=Expr;
|
|
Ref:=nil;
|
|
Ref:=nil;
|
|
|
|
+ Prop:=nil;
|
|
Left:=nil;
|
|
Left:=nil;
|
|
SelfJS:=nil;
|
|
SelfJS:=nil;
|
|
Call:=nil;
|
|
Call:=nil;
|
|
@@ -17021,6 +17032,17 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
|
|
+ else if Expr is TParamsExpr then
|
|
|
|
+ begin
|
|
|
|
+ PosEl:=Expr;
|
|
|
|
+ if not (Expr.CustomData is TResolvedReference) then
|
|
|
|
+ RaiseNotSupported(Expr,AContext,20190208105144);
|
|
|
|
+ Ref:=TResolvedReference(PosEl.CustomData);
|
|
|
|
+ if Ref.Declaration.ClassType<>TPasProperty then
|
|
|
|
+ RaiseNotSupported(Expr,AContext,20190208105222);
|
|
|
|
+ Left:=TParamsExpr(Expr).Value;
|
|
|
|
+ aResolver.ComputeElement(Left,LeftResolved,[]);
|
|
|
|
+ end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
RaiseNotSupported(Expr,AContext,20190201163210);
|
|
RaiseNotSupported(Expr,AContext,20190201163210);
|
|
@@ -17029,7 +17051,6 @@ begin
|
|
|
|
|
|
LoTypeEl:=LeftResolved.LoTypeEl;
|
|
LoTypeEl:=LeftResolved.LoTypeEl;
|
|
IdentEl:=LeftResolved.IdentEl;
|
|
IdentEl:=LeftResolved.IdentEl;
|
|
- Prop:=nil;
|
|
|
|
IsConstructorNormalCall:=false;
|
|
IsConstructorNormalCall:=false;
|
|
if Ref<>nil then
|
|
if Ref<>nil then
|
|
begin
|
|
begin
|