|
@@ -5524,15 +5524,21 @@ var
|
|
Params: TParamsExpr;
|
|
Params: TParamsExpr;
|
|
Param: TPasExpr;
|
|
Param: TPasExpr;
|
|
ParamResolved: TPasResolverResult;
|
|
ParamResolved: TPasResolverResult;
|
|
|
|
+ bt: TResolverBaseType;
|
|
|
|
+ C: TClass;
|
|
begin
|
|
begin
|
|
Result:=inherited;
|
|
Result:=inherited;
|
|
Params:=TParamsExpr(Expr);
|
|
Params:=TParamsExpr(Expr);
|
|
Param:=Params.Params[1];
|
|
Param:=Params.Params[1];
|
|
ComputeElement(Param,ParamResolved,[]);
|
|
ComputeElement(Param,ParamResolved,[]);
|
|
Result:=cIncompatible;
|
|
Result:=cIncompatible;
|
|
- if ParamResolved.BaseType=btContext then
|
|
|
|
|
|
+ bt:=ParamResolved.BaseType;
|
|
|
|
+ if bt=btRange then
|
|
|
|
+ bt:=ParamResolved.SubType;
|
|
|
|
+ if bt=btContext then
|
|
begin
|
|
begin
|
|
- if ParamResolved.LoTypeEl is TPasEnumType then
|
|
|
|
|
|
+ C:=ParamResolved.LoTypeEl.ClassType;
|
|
|
|
+ if (C=TPasEnumType) or (C=TPasRangeType) then
|
|
Result:=cExact
|
|
Result:=cExact
|
|
end;
|
|
end;
|
|
if Result=cIncompatible then
|
|
if Result=cIncompatible then
|
|
@@ -11831,6 +11837,9 @@ var
|
|
AddExpr: TJSAdditiveExpressionPlus;
|
|
AddExpr: TJSAdditiveExpressionPlus;
|
|
Int: TMaxPrecInt;
|
|
Int: TMaxPrecInt;
|
|
aResolver: TPas2JSResolver;
|
|
aResolver: TPas2JSResolver;
|
|
|
|
+ from_bt: TResolverBaseType;
|
|
|
|
+ FromTypeEl: TPasType;
|
|
|
|
+ ElTypeResolved: TPasResolverResult;
|
|
begin
|
|
begin
|
|
Result:=nil;
|
|
Result:=nil;
|
|
Param:=El.Params[0];
|
|
Param:=El.Params[0];
|
|
@@ -11839,8 +11848,16 @@ begin
|
|
JSBaseTypeData:=nil;
|
|
JSBaseTypeData:=nil;
|
|
JSBaseType:=pbtNone;
|
|
JSBaseType:=pbtNone;
|
|
|
|
|
|
|
|
+ from_bt:=ParamResolved.BaseType;
|
|
|
|
+ FromTypeEl:=ParamResolved.LoTypeEl;
|
|
|
|
+ if from_bt=btRange then
|
|
|
|
+ begin
|
|
|
|
+ from_bt:=ParamResolved.SubType;
|
|
|
|
+ aResolver.ComputeElement(TPasRangeType(FromTypeEl).RangeExpr.left,ElTypeResolved,[rcConstant]);
|
|
|
|
+ FromTypeEl:=ElTypeResolved.LoTypeEl;
|
|
|
|
+ end;
|
|
to_bt:=ToBaseTypeData.BaseType;
|
|
to_bt:=ToBaseTypeData.BaseType;
|
|
- if to_bt=ParamResolved.BaseType then
|
|
|
|
|
|
+ if from_bt=to_bt then
|
|
begin
|
|
begin
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
exit;
|
|
exit;
|
|
@@ -11848,14 +11865,14 @@ begin
|
|
|
|
|
|
if to_bt in btAllJSInteger then
|
|
if to_bt in btAllJSInteger then
|
|
begin
|
|
begin
|
|
- if ParamResolved.BaseType in btAllJSInteger then
|
|
|
|
|
|
+ if from_bt in btAllJSInteger then
|
|
begin
|
|
begin
|
|
// integer to integer -> value
|
|
// integer to integer -> value
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
- Result:=ConvertIntToInt(Result,ParamResolved.BaseType,to_bt,El,AContext);
|
|
|
|
|
|
+ Result:=ConvertIntToInt(Result,from_bt,to_bt,El,AContext);
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
- else if ParamResolved.BaseType in btAllJSBooleans then
|
|
|
|
|
|
+ else if from_bt in btAllJSBooleans then
|
|
begin
|
|
begin
|
|
// boolean to integer -> value?1:0
|
|
// boolean to integer -> value?1:0
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
@@ -11870,7 +11887,7 @@ begin
|
|
Result:=CondExpr;
|
|
Result:=CondExpr;
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
- else if ParamResolved.BaseType in btAllJSChars then
|
|
|
|
|
|
+ else if from_bt in btAllJSChars then
|
|
begin
|
|
begin
|
|
// char to integer
|
|
// char to integer
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
@@ -11878,9 +11895,9 @@ begin
|
|
Result:=ConvertIntToInt(Result,btWord,to_bt,El,AContext);
|
|
Result:=ConvertIntToInt(Result,btWord,to_bt,El,AContext);
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
- else if ParamResolved.BaseType=btContext then
|
|
|
|
|
|
+ else if from_bt=btContext then
|
|
begin
|
|
begin
|
|
- if ParamResolved.LoTypeEl.ClassType=TPasEnumType then
|
|
|
|
|
|
+ if FromTypeEl.ClassType=TPasEnumType then
|
|
begin
|
|
begin
|
|
// e.g. longint(TEnum) -> value
|
|
// e.g. longint(TEnum) -> value
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
@@ -11904,7 +11921,7 @@ begin
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
- else if (to_bt=btCurrency) and (ParamResolved.BaseType in btAllJSFloats) then
|
|
|
|
|
|
+ else if (to_bt=btCurrency) and (from_bt in btAllJSFloats) then
|
|
begin
|
|
begin
|
|
// currency(double) -> double*10000
|
|
// currency(double) -> double*10000
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
@@ -11914,13 +11931,13 @@ begin
|
|
end
|
|
end
|
|
else if to_bt in btAllJSBooleans then
|
|
else if to_bt in btAllJSBooleans then
|
|
begin
|
|
begin
|
|
- if ParamResolved.BaseType in btAllJSBooleans then
|
|
|
|
|
|
+ if from_bt in btAllJSBooleans then
|
|
begin
|
|
begin
|
|
// boolean to boolean -> value
|
|
// boolean to boolean -> value
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
- else if ParamResolved.BaseType in btAllJSInteger then
|
|
|
|
|
|
+ else if from_bt in btAllJSInteger then
|
|
begin
|
|
begin
|
|
// integer to boolean -> value!=0
|
|
// integer to boolean -> value!=0
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
@@ -11949,7 +11966,7 @@ begin
|
|
end
|
|
end
|
|
else if to_bt in btAllJSFloats then
|
|
else if to_bt in btAllJSFloats then
|
|
begin
|
|
begin
|
|
- if ParamResolved.BaseType in (btAllJSFloats+btAllJSInteger) then
|
|
|
|
|
|
+ if from_bt in (btAllJSFloats+btAllJSInteger) then
|
|
begin
|
|
begin
|
|
// int to double -> value
|
|
// int to double -> value
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
@@ -11975,13 +11992,13 @@ begin
|
|
end
|
|
end
|
|
else if to_bt in btAllJSStrings then
|
|
else if to_bt in btAllJSStrings then
|
|
begin
|
|
begin
|
|
- if ParamResolved.BaseType in btAllJSStringAndChars then
|
|
|
|
|
|
+ if from_bt in btAllJSStringAndChars then
|
|
begin
|
|
begin
|
|
// string or char to string -> value
|
|
// string or char to string -> value
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
- else if ParamResolved.BaseType=btPointer then
|
|
|
|
|
|
+ else if from_bt=btPointer then
|
|
begin
|
|
begin
|
|
// string(aPointer) -> value
|
|
// string(aPointer) -> value
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
@@ -12004,15 +12021,15 @@ begin
|
|
end
|
|
end
|
|
else if to_bt=btChar then
|
|
else if to_bt=btChar then
|
|
begin
|
|
begin
|
|
- if ParamResolved.BaseType=btChar then
|
|
|
|
|
|
+ if from_bt=btChar then
|
|
begin
|
|
begin
|
|
// char to char
|
|
// char to char
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
- else if (ParamResolved.BaseType in btAllJSInteger)
|
|
|
|
- or ((ParamResolved.BaseType=btContext)
|
|
|
|
- and (aResolver.ResolveAliasType(ParamResolved.LoTypeEl).ClassType=TPasEnumType))
|
|
|
|
|
|
+ else if (from_bt in btAllJSInteger)
|
|
|
|
+ or ((from_bt=btContext)
|
|
|
|
+ and (FromTypeEl.ClassType=TPasEnumType))
|
|
then
|
|
then
|
|
begin
|
|
begin
|
|
// Note: convert value first in case it raises an exception
|
|
// Note: convert value first in case it raises an exception
|
|
@@ -12030,7 +12047,7 @@ begin
|
|
end;
|
|
end;
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
- else if (ParamResolved.BaseType in (btArrayRangeTypes+[btRange]))
|
|
|
|
|
|
+ else if (from_bt in (btArrayRangeTypes+[btRange]))
|
|
or (IsParamPas2JSBaseType and (JSBaseType=pbtJSValue)) then
|
|
or (IsParamPas2JSBaseType and (JSBaseType=pbtJSValue)) then
|
|
begin
|
|
begin
|
|
// convert value to char -> rtl.getChar(value)
|
|
// convert value to char -> rtl.getChar(value)
|
|
@@ -12071,13 +12088,13 @@ begin
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
- else if ParamResolved.BaseType in btAllJSStrings then
|
|
|
|
|
|
+ else if from_bt in btAllJSStrings then
|
|
begin
|
|
begin
|
|
// pointer(aString) -> value
|
|
// pointer(aString) -> value
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
- else if ParamResolved.BaseType=btContext then
|
|
|
|
|
|
+ else if from_bt=btContext then
|
|
begin
|
|
begin
|
|
// convert user type/value to pointer -> value
|
|
// convert user type/value to pointer -> value
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
@@ -12753,6 +12770,8 @@ var
|
|
Minus: TJSAdditiveExpressionMinus;
|
|
Minus: TJSAdditiveExpressionMinus;
|
|
Add: TJSAdditiveExpressionPlus;
|
|
Add: TJSAdditiveExpressionPlus;
|
|
aResolver: TPas2JSResolver;
|
|
aResolver: TPas2JSResolver;
|
|
|
|
+ bt: TResolverBaseType;
|
|
|
|
+ C: TClass;
|
|
begin
|
|
begin
|
|
Result:=nil;
|
|
Result:=nil;
|
|
aResolver:=AContext.Resolver;
|
|
aResolver:=AContext.Resolver;
|
|
@@ -12760,7 +12779,10 @@ begin
|
|
RaiseInconsistency(20170210105235,El);
|
|
RaiseInconsistency(20170210105235,El);
|
|
Param:=El.Params[0];
|
|
Param:=El.Params[0];
|
|
aResolver.ComputeElement(Param,ParamResolved,[]);
|
|
aResolver.ComputeElement(Param,ParamResolved,[]);
|
|
- if ParamResolved.BaseType=btChar then
|
|
|
|
|
|
+ bt:=ParamResolved.BaseType;
|
|
|
|
+ if bt=btRange then
|
|
|
|
+ bt:=ParamResolved.SubType;
|
|
|
|
+ if bt=btChar then
|
|
begin
|
|
begin
|
|
if Param is TParamsExpr then
|
|
if Param is TParamsExpr then
|
|
begin
|
|
begin
|
|
@@ -12805,7 +12827,7 @@ begin
|
|
Result:=CreateCallCharCodeAt(Result,0,El);
|
|
Result:=CreateCallCharCodeAt(Result,0,El);
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
- else if ParamResolved.BaseType in btAllJSBooleans then
|
|
|
|
|
|
+ else if bt in btAllJSBooleans then
|
|
begin
|
|
begin
|
|
// ord(bool)
|
|
// ord(bool)
|
|
Result:=CheckOrdConstant(aResolver,Param);
|
|
Result:=CheckOrdConstant(aResolver,Param);
|
|
@@ -12819,9 +12841,10 @@ begin
|
|
Result:=Add;
|
|
Result:=Add;
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
- else if ParamResolved.BaseType=btContext then
|
|
|
|
|
|
+ else if bt=btContext then
|
|
begin
|
|
begin
|
|
- if ParamResolved.LoTypeEl.ClassType=TPasEnumType then
|
|
|
|
|
|
+ C:=ParamResolved.LoTypeEl.ClassType;
|
|
|
|
+ if (C=TPasEnumType) or (C=TPasRangeType) then
|
|
begin
|
|
begin
|
|
// ord(enum) -> enum
|
|
// ord(enum) -> enum
|
|
Result:=ConvertExpression(Param,AContext);
|
|
Result:=ConvertExpression(Param,AContext);
|
|
@@ -12856,25 +12879,39 @@ function TPasToJSConverter.ConvertBuiltIn_LowHigh(El: TParamsExpr;
|
|
end;
|
|
end;
|
|
|
|
|
|
var
|
|
var
|
|
- ResolvedEl: TPasResolverResult;
|
|
|
|
Param: TPasExpr;
|
|
Param: TPasExpr;
|
|
|
|
+ aResolver: TPas2JSResolver;
|
|
|
|
+ ResolvedEl: TPasResolverResult;
|
|
TypeEl: TPasType;
|
|
TypeEl: TPasType;
|
|
Ranges: TPasExprArray;
|
|
Ranges: TPasExprArray;
|
|
Value: TResEvalValue;
|
|
Value: TResEvalValue;
|
|
Call: TJSCallExpression;
|
|
Call: TJSCallExpression;
|
|
MinusExpr: TJSAdditiveExpressionMinus;
|
|
MinusExpr: TJSAdditiveExpressionMinus;
|
|
MinVal, MaxVal: TMaxPrecInt;
|
|
MinVal, MaxVal: TMaxPrecInt;
|
|
|
|
+ bt: TResolverBaseType;
|
|
begin
|
|
begin
|
|
Result:=nil;
|
|
Result:=nil;
|
|
if AContext.Resolver=nil then
|
|
if AContext.Resolver=nil then
|
|
RaiseInconsistency(20170210120659,El);
|
|
RaiseInconsistency(20170210120659,El);
|
|
Param:=El.Params[0];
|
|
Param:=El.Params[0];
|
|
- AContext.Resolver.ComputeElement(Param,ResolvedEl,[]);
|
|
|
|
- case ResolvedEl.BaseType of
|
|
|
|
|
|
+ aResolver:=AContext.Resolver;
|
|
|
|
+ aResolver.ComputeElement(Param,ResolvedEl,[]);
|
|
|
|
+ bt:=ResolvedEl.BaseType;
|
|
|
|
+ if bt=btRange then
|
|
|
|
+ bt:=ResolvedEl.SubType;
|
|
|
|
+ case bt of
|
|
btContext:
|
|
btContext:
|
|
begin
|
|
begin
|
|
TypeEl:=ResolvedEl.LoTypeEl;
|
|
TypeEl:=ResolvedEl.LoTypeEl;
|
|
- if TypeEl.ClassType=TPasEnumType then
|
|
|
|
|
|
+ if TypeEl.ClassType=TPasRangeType then
|
|
|
|
+ begin
|
|
|
|
+ if IsLow then
|
|
|
|
+ Result:=ConvertElement(TPasRangeType(TypeEl).RangeExpr.left,AContext)
|
|
|
|
+ else
|
|
|
|
+ Result:=ConvertElement(TPasRangeType(TypeEl).RangeExpr.right,AContext);
|
|
|
|
+ exit;
|
|
|
|
+ end
|
|
|
|
+ else if TypeEl.ClassType=TPasEnumType then
|
|
begin
|
|
begin
|
|
CreateEnumValue(TPasEnumType(TypeEl));
|
|
CreateEnumValue(TPasEnumType(TypeEl));
|
|
exit;
|
|
exit;
|
|
@@ -13261,25 +13298,32 @@ var
|
|
end;
|
|
end;
|
|
|
|
|
|
var
|
|
var
|
|
- ResolvedEl: TPasResolverResult;
|
|
|
|
|
|
+ aResolver: TPas2JSResolver;
|
|
|
|
+ ResolvedEl, ElTypeResolved: TPasResolverResult;
|
|
NeedStrLit: Boolean;
|
|
NeedStrLit: Boolean;
|
|
Call: TJSCallExpression;
|
|
Call: TJSCallExpression;
|
|
Bracket: TJSBracketMemberExpression;
|
|
Bracket: TJSBracketMemberExpression;
|
|
Arg: TJSElement;
|
|
Arg: TJSElement;
|
|
|
|
+ bt: TResolverBaseType;
|
|
|
|
+ TypeEl: TPasType;
|
|
begin
|
|
begin
|
|
Result:=nil;
|
|
Result:=nil;
|
|
- AContext.Resolver.ComputeElement(El,ResolvedEl,[]);
|
|
|
|
|
|
+ aResolver:=AContext.Resolver;
|
|
|
|
+ aResolver.ComputeElement(El,ResolvedEl,[]);
|
|
Add:=nil;
|
|
Add:=nil;
|
|
Call:=nil;
|
|
Call:=nil;
|
|
Bracket:=nil;
|
|
Bracket:=nil;
|
|
try
|
|
try
|
|
NeedStrLit:=false;
|
|
NeedStrLit:=false;
|
|
- if ResolvedEl.BaseType in (btAllJSBooleans+btAllJSInteger-[btCurrency]) then
|
|
|
|
|
|
+ bt:=ResolvedEl.BaseType;
|
|
|
|
+ if bt=btRange then
|
|
|
|
+ bt:=ResolvedEl.SubType;
|
|
|
|
+ if bt in (btAllJSBooleans+btAllJSInteger-[btCurrency]) then
|
|
begin
|
|
begin
|
|
NeedStrLit:=true;
|
|
NeedStrLit:=true;
|
|
Add:=ConvertExpression(El,AContext);
|
|
Add:=ConvertExpression(El,AContext);
|
|
end
|
|
end
|
|
- else if ResolvedEl.BaseType in (btAllJSFloats+[btCurrency]) then
|
|
|
|
|
|
+ else if bt in (btAllJSFloats+[btCurrency]) then
|
|
begin
|
|
begin
|
|
// convert to rtl.floatToStr(El,width,precision)
|
|
// convert to rtl.floatToStr(El,width,precision)
|
|
Call:=CreateCallExpression(El);
|
|
Call:=CreateCallExpression(El);
|
|
@@ -13296,15 +13340,21 @@ begin
|
|
Call:=nil;
|
|
Call:=nil;
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
- else if IsStrFunc and (ResolvedEl.BaseType in btAllJSStringAndChars) then
|
|
|
|
|
|
+ else if IsStrFunc and (bt in btAllJSStringAndChars) then
|
|
Add:=ConvertExpression(El,AContext)
|
|
Add:=ConvertExpression(El,AContext)
|
|
- else if ResolvedEl.BaseType=btContext then
|
|
|
|
|
|
+ else if bt=btContext then
|
|
begin
|
|
begin
|
|
- if ResolvedEl.LoTypeEl.ClassType=TPasEnumType then
|
|
|
|
|
|
+ TypeEl:=ResolvedEl.LoTypeEl;
|
|
|
|
+ if TypeEl.ClassType=TPasRangeType then
|
|
|
|
+ begin
|
|
|
|
+ aResolver.ComputeElement(TPasRangeType(TypeEl).RangeExpr.left,ElTypeResolved,[rcConstant]);
|
|
|
|
+ TypeEl:=ElTypeResolved.LoTypeEl;
|
|
|
|
+ end;
|
|
|
|
+ if TypeEl.ClassType=TPasEnumType then
|
|
begin
|
|
begin
|
|
// create enumtype[enumvalue]
|
|
// create enumtype[enumvalue]
|
|
Bracket:=TJSBracketMemberExpression(CreateElement(TJSBracketMemberExpression,El));
|
|
Bracket:=TJSBracketMemberExpression(CreateElement(TJSBracketMemberExpression,El));
|
|
- Bracket.MExpr:=CreateReferencePathExpr(TPasEnumType(ResolvedEl.LoTypeEl),AContext);
|
|
|
|
|
|
+ Bracket.MExpr:=CreateReferencePathExpr(TPasEnumType(TypeEl),AContext);
|
|
Bracket.Name:=ConvertExpression(El,AContext);
|
|
Bracket.Name:=ConvertExpression(El,AContext);
|
|
Add:=Bracket;
|
|
Add:=Bracket;
|
|
Bracket:=nil;
|
|
Bracket:=nil;
|
|
@@ -13389,28 +13439,32 @@ function TPasToJSConverter.ConvertBuiltIn_Val(El: TParamsExpr;
|
|
AContext: TConvertContext): TJSElement;
|
|
AContext: TConvertContext): TJSElement;
|
|
// val(const s: string; out value: valuetype; out Code: integertype)
|
|
// val(const s: string; out value: valuetype; out Code: integertype)
|
|
// for enum it is converted to
|
|
// for enum it is converted to
|
|
-// value = rtl.valEnum(s,enumTupe,function(c){ Code=c; })
|
|
|
|
|
|
+// value = rtl.valEnum(s,enumType,function(c){ Code=c; })
|
|
var
|
|
var
|
|
|
|
+ aResolver: TPas2JSResolver;
|
|
AssignContext: TAssignContext;
|
|
AssignContext: TAssignContext;
|
|
ValueExpr, CodeExpr: TPasExpr;
|
|
ValueExpr, CodeExpr: TPasExpr;
|
|
Call: TJSCallExpression;
|
|
Call: TJSCallExpression;
|
|
Params: TPasExprArray;
|
|
Params: TPasExprArray;
|
|
EnumType: TPasEnumType;
|
|
EnumType: TPasEnumType;
|
|
Fun: TJSFunctionDeclarationStatement;
|
|
Fun: TJSFunctionDeclarationStatement;
|
|
- ExprResolved: TPasResolverResult;
|
|
|
|
|
|
+ ExprResolved, ElTypeResolved: TPasResolverResult;
|
|
ExprArg: TPasArgument;
|
|
ExprArg: TPasArgument;
|
|
AssignSt: TJSSimpleAssignStatement;
|
|
AssignSt: TJSSimpleAssignStatement;
|
|
SetterArgName: String;
|
|
SetterArgName: String;
|
|
ArgJS, SetExpr: TJSElement;
|
|
ArgJS, SetExpr: TJSElement;
|
|
|
|
+ bt: TResolverBaseType;
|
|
|
|
+ LoTypeEl: TPasType;
|
|
begin
|
|
begin
|
|
Result:=nil;
|
|
Result:=nil;
|
|
|
|
+ aResolver:=AContext.Resolver;
|
|
Params:=El.Params;
|
|
Params:=El.Params;
|
|
Call:=nil;
|
|
Call:=nil;
|
|
AssignContext:=TAssignContext.Create(El,nil,AContext);
|
|
AssignContext:=TAssignContext.Create(El,nil,AContext);
|
|
try
|
|
try
|
|
//
|
|
//
|
|
ValueExpr:=Params[1];
|
|
ValueExpr:=Params[1];
|
|
- AContext.Resolver.ComputeElement(ValueExpr,AssignContext.LeftResolved,[rcNoImplicitProc]);
|
|
|
|
|
|
+ aResolver.ComputeElement(ValueExpr,AssignContext.LeftResolved,[rcNoImplicitProc]);
|
|
|
|
|
|
// rtl.valEnum()
|
|
// rtl.valEnum()
|
|
Call:=CreateCallExpression(El);
|
|
Call:=CreateCallExpression(El);
|
|
@@ -13419,11 +13473,20 @@ begin
|
|
// add arg string
|
|
// add arg string
|
|
Call.AddArg(ConvertExpression(Params[0],AContext));
|
|
Call.AddArg(ConvertExpression(Params[0],AContext));
|
|
// add arg enumtype
|
|
// add arg enumtype
|
|
- if AssignContext.LeftResolved.BaseType=btContext then
|
|
|
|
|
|
+ bt:=AssignContext.LeftResolved.BaseType;
|
|
|
|
+ if bt=btRange then
|
|
|
|
+ bt:=AssignContext.LeftResolved.SubType;
|
|
|
|
+ if bt=btContext then
|
|
begin
|
|
begin
|
|
- if AssignContext.LeftResolved.LoTypeEl is TPasEnumType then
|
|
|
|
|
|
+ LoTypeEl:=AssignContext.LeftResolved.LoTypeEl;
|
|
|
|
+ if LoTypeEl.ClassType=TPasRangeType then
|
|
|
|
+ begin
|
|
|
|
+ aResolver.ComputeElement(TPasRangeType(LoTypeEl).RangeExpr.left,ElTypeResolved,[rcConstant]);
|
|
|
|
+ LoTypeEl:=ElTypeResolved.LoTypeEl;
|
|
|
|
+ end;
|
|
|
|
+ if LoTypeEl.ClassType=TPasEnumType then
|
|
begin
|
|
begin
|
|
- EnumType:=TPasEnumType(AssignContext.LeftResolved.LoTypeEl);
|
|
|
|
|
|
+ EnumType:=TPasEnumType(LoTypeEl);
|
|
Call.AddArg(CreateReferencePathExpr(EnumType,AContext));
|
|
Call.AddArg(CreateReferencePathExpr(EnumType,AContext));
|
|
end else
|
|
end else
|
|
RaiseNotSupported(Params[1],AContext,20181214145226,GetResolverResultDbg(AssignContext.LeftResolved));
|
|
RaiseNotSupported(Params[1],AContext,20181214145226,GetResolverResultDbg(AssignContext.LeftResolved));
|