@@ -209,7 +209,7 @@ function Contains(const APosition: IPosition; const ALeft, ARight: TValue; const
209
209
RaiseError(APosition, SValueIsNotEnumerable);
210
210
LEnumObject := LValue.AsObject;
211
211
try
212
- TRightType := AContext.RttiContext.GetType(LEnumObject.ClassType);
212
+ TRightType := AContext.RttiContext() .GetType(LEnumObject.ClassType);
213
213
LEnumMoveNextMethod := TRightType.GetMethod(' MoveNext' );
214
214
LEnumCurrentProperty := TRightType.GetProperty(' Current' );
215
215
while LEnumMoveNextMethod.Invoke(LEnumObject, []).AsBoolean do
@@ -300,7 +300,7 @@ function Contains(const APosition: IPosition; const ALeft, ARight: TValue; const
300
300
result := false;
301
301
if not IsEnumerable(AContext, ARight) and not MatchMap(AContext, ARight) then
302
302
RaiseError(APosition, SValueIsNotEnumerableOrMap);
303
- TRightType := AContext.RttiContext.GetType(ARight.TypeInfo);
303
+ TRightType := AContext.RttiContext() .GetType(ARight.TypeInfo);
304
304
case TRightType.TypeKind of
305
305
tkInterface:
306
306
VisitInterface;
@@ -323,7 +323,7 @@ function IsEnumerable(const AContext: ITemplateContext; const AValue: TValue): b
323
323
tkDynArray, tkArray:
324
324
exit(true);
325
325
tkClass, tkClassRef:
326
- exit(AContext.RttiContext.GetType(AValue.TypeInfo).GetMethod(' GetEnumerator' ) <> nil );
326
+ exit(AContext.RttiContext() .GetType(AValue.TypeInfo).GetMethod(' GetEnumerator' ) <> nil );
327
327
else
328
328
exit(false);
329
329
end ;
@@ -480,7 +480,7 @@ function AsString(const AValue: TValue; const AContext: ITemplateContext): strin
480
480
if AValue.TypeInfo = TypeInfo(TValue) then
481
481
exit(AsString(AValue.AsType<TValue>(), AContext))
482
482
else
483
- exit(AContext.RttiContext.GetType(AValue.TypeInfo).Name );
483
+ exit(AContext.RttiContext() .GetType(AValue.TypeInfo).Name );
484
484
else
485
485
exit(' ' );
486
486
end ;
@@ -515,7 +515,7 @@ function TryDerefTemplateVariables(const APosition: IPosition; const AObj: TValu
515
515
begin
516
516
// Ideally wuld like to use TryGetItem, but couldn't get it working
517
517
// with TValue result...
518
- LObjectType := AContext.RttiContext.GetType(AObj.TypeInfo);
518
+ LObjectType := AContext.RttiContext() .GetType(AObj.TypeInfo);
519
519
LContainsKeyMethod := LObjectType.GetMethod(' ContainsKey' );
520
520
try
521
521
if not LContainsKeyMethod.Invoke(AObj, [ADeref]).AsBoolean then
@@ -607,7 +607,7 @@ function TryDerefClass(const APosition: IPosition; const obj: TValue; const ADer
607
607
end ;
608
608
end ;
609
609
end ;
610
- exit(TryGetFieldOrProperty(obj.AsObject, AContext.RttiContext.GetType(obj.TypeInfo), ADeref, AContext, AResult));
610
+ exit(TryGetFieldOrProperty(obj.AsObject, AContext.RttiContext() .GetType(obj.TypeInfo), ADeref, AContext, AResult));
611
611
end ;
612
612
613
613
function TryDerefList (const APosition: IPosition; const AObj: TValue; const ADeref: TValue; const ARaiseIfMissing: boolean; const AContext: ITemplateContext; out AResult: TValue): boolean;
@@ -616,7 +616,7 @@ function TryDerefList(const APosition: IPosition; const AObj: TValue; const ADer
616
616
LProperty: TRttiProperty;
617
617
LIndexedProperty: TRttiIndexedProperty;
618
618
begin
619
- LType := AContext.RttiContext.GetType(AObj.TypeInfo);
619
+ LType := AContext.RttiContext() .GetType(AObj.TypeInfo);
620
620
try
621
621
if IsIntLike(ADeref) then
622
622
begin
@@ -656,7 +656,7 @@ function TryDerefDictionary(const APosition: IPosition; const AObj: TValue; cons
656
656
LIndexedProperty: TRttiIndexedProperty;
657
657
LDerefValue: TValue;
658
658
begin
659
- LType := AContext.RttiContext.GetType(AObj.TypeInfo);
659
+ LType := AContext.RttiContext() .GetType(AObj.TypeInfo);
660
660
try
661
661
if IsStrLike(ADeref) then
662
662
begin
@@ -868,7 +868,7 @@ function TryDeref(const APosition: IPosition; const AVar, ADeref: TValue; const
868
868
LMax: int64;
869
869
begin
870
870
LIndex := AsInt(ADeref, AContext);
871
- LElementType := AContext.RttiContext.GetType(AObj.TypeInfo) as TRttiArrayType;
871
+ LElementType := AContext.RttiContext() .GetType(AObj.TypeInfo) as TRttiArrayType;
872
872
LArrayDimType := LElementType.Dimensions[0 ];
873
873
LMin := 0 ;
874
874
if LArrayDimType <> nil then
@@ -908,7 +908,7 @@ function TryDeref(const APosition: IPosition; const AVar, ADeref: TValue; const
908
908
exit(true);
909
909
end ;
910
910
911
- exit(TryGetFieldOrProperty(LObj.GetReferenceToRawData, AContext.RttiContext.GetType(AObj.TypeInfo), ADeref, AContext, AResult));
911
+ exit(TryGetFieldOrProperty(LObj.GetReferenceToRawData, AContext.RttiContext() .GetType(AObj.TypeInfo), ADeref, AContext, AResult));
912
912
end ;
913
913
914
914
function TryDerefInterface (const AObj: TValue; const ADeref: TValue; out AResult: TValue): boolean;
@@ -1047,7 +1047,9 @@ function MatchJsonValue(const AContext: ITemplateContext; const ATypeInfo: PType
1047
1047
(ATypeInfo = TypeInfo(TJSONNull)) or //
1048
1048
(ATypeInfo = TypeInfo(TJSONNumber)) or //
1049
1049
(ATypeInfo = TypeInfo(TJSONString)) or //
1050
+ { $IFDEF SUPPORT_JSON_BOOL}
1050
1051
(ATypeInfo = TypeInfo(TJSONBool)) or //
1052
+ { $ENDIF}
1051
1053
(ATypeInfo = TypeInfo(TJSONTrue)) or //
1052
1054
(ATypeInfo = TypeInfo(TJSONFalse)) //
1053
1055
);
@@ -1116,7 +1118,7 @@ procedure PopulateStackFrameFromDictionary(const AContext: ITemplateContext; con
1116
1118
LMethod := ARttiType.GetMethod(' GetEnumerator' );
1117
1119
LEnumObject := LMethod.Invoke(LDictionary, []).AsObject;
1118
1120
try
1119
- LEnumType := AContext.RttiContext.GetType(LEnumObject.ClassType);
1121
+ LEnumType := AContext.RttiContext() .GetType(LEnumObject.ClassType);
1120
1122
LEnumMoveNextMethod := LEnumType.GetMethod(' MoveNext' );
1121
1123
LEnumCurrentProperty := LEnumType.GetProperty(' Current' );
1122
1124
LPairKeyField := nil ;
@@ -1127,7 +1129,7 @@ procedure PopulateStackFrameFromDictionary(const AContext: ITemplateContext; con
1127
1129
LPairRecordPtr := LEnumPair.GetReferenceToRawData;
1128
1130
if LPairKeyField = nil then
1129
1131
begin
1130
- LEnumType := AContext.RttiContext.GetType(LEnumPair.TypeInfo);
1132
+ LEnumType := AContext.RttiContext() .GetType(LEnumPair.TypeInfo);
1131
1133
LPairKeyField := LEnumType.GetField(' Key' );
1132
1134
LPairValueField := LEnumType.GetField(' Value' );
1133
1135
end ;
@@ -1156,7 +1158,7 @@ function IsDataSetEmpty(const AContext: ITemplateContext; const AObject: TObject
1156
1158
begin
1157
1159
if AObject = nil then
1158
1160
exit(true);
1159
- LType := AContext.RttiContext.GetType(AObject.ClassType);
1161
+ LType := AContext.RttiContext() .GetType(AObject.ClassType);
1160
1162
LCountProp := LType.GetProperty(' RecordCount' );
1161
1163
LCount := LCountProp.GetValue(AObject).AsInteger;
1162
1164
exit(LCount = 0 );
@@ -1168,7 +1170,7 @@ function IsRecordCountEmpty(const AContext: ITemplateContext; const AObject: TVa
1168
1170
LCount: integer;
1169
1171
LCountProp: TRttiMethod;
1170
1172
begin
1171
- LType := AContext.RttiContext.GetType(AObject.TypeInfo);
1173
+ LType := AContext.RttiContext() .GetType(AObject.TypeInfo);
1172
1174
LCountProp := LType.GetMethod(' GetCount' );
1173
1175
LCount := LCountProp.Invoke(AObject, []).AsInteger;
1174
1176
exit(LCount = 0 );
@@ -1182,7 +1184,7 @@ function IsGenericCollectionEmpty(const AContext: ITemplateContext; const AObjec
1182
1184
begin
1183
1185
if AObject = nil then
1184
1186
exit(true);
1185
- LType := AContext.RttiContext.GetType(AObject.ClassType);
1187
+ LType := AContext.RttiContext() .GetType(AObject.ClassType);
1186
1188
LCountProp := LType.GetProperty(' Count' );
1187
1189
LCount := LCountProp.GetValue(AObject).AsInteger;
1188
1190
exit(LCount = 0 );
0 commit comments