mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 18:09:30 +02:00
fcl-passrc: fixed MaxPrecInt to TMaxPrecInt, using TMaxPrecInt instead of int64
git-svn-id: trunk@39940 -
This commit is contained in:
parent
c7675335a6
commit
d9be52c759
File diff suppressed because it is too large
Load Diff
@ -1776,7 +1776,7 @@ type
|
||||
function ProcNeedsParams(El: TPasProcedureType): boolean;
|
||||
function IsProcOverride(AncestorProc, DescendantProc: TPasProcedure): boolean;
|
||||
function GetTopLvlProc(El: TPasElement): TPasProcedure;
|
||||
function GetRangeLength(RangeExpr: TPasExpr): MaxPrecInt;
|
||||
function GetRangeLength(RangeExpr: TPasExpr): TMaxPrecInt;
|
||||
function EvalRangeLimit(RangeExpr: TPasExpr; Flags: TResEvalFlags;
|
||||
EvalLow: boolean; ErrorEl: TPasElement): TResEvalValue; virtual; // compute low() or high()
|
||||
function EvalTypeRange(Decl: TPasType; Flags: TResEvalFlags): TResEvalValue; virtual; // compute low() and high()
|
||||
@ -1785,9 +1785,9 @@ type
|
||||
function GetCombinedBoolean(Bool1, Bool2: TResolverBaseType; ErrorEl: TPasElement): TResolverBaseType; virtual;
|
||||
function GetCombinedInt(const Int1, Int2: TPasResolverResult; ErrorEl: TPasElement): TResolverBaseType; virtual;
|
||||
procedure GetIntegerProps(bt: TResolverBaseType; out Precision: word; out Signed: boolean);
|
||||
function GetIntegerRange(bt: TResolverBaseType; out MinVal, MaxVal: MaxPrecInt): boolean;
|
||||
function GetIntegerRange(bt: TResolverBaseType; out MinVal, MaxVal: TMaxPrecInt): boolean;
|
||||
function GetIntegerBaseType(Precision: word; Signed: boolean; ErrorEl: TPasElement): TResolverBaseType;
|
||||
function GetSmallestIntegerBaseType(MinVal, MaxVal: MaxPrecInt): TResolverBaseType;
|
||||
function GetSmallestIntegerBaseType(MinVal, MaxVal: TMaxPrecInt): TResolverBaseType;
|
||||
function GetCombinedChar(const Char1, Char2: TPasResolverResult; ErrorEl: TPasElement): TResolverBaseType; virtual;
|
||||
function GetCombinedString(const Str1, Str2: TPasResolverResult; ErrorEl: TPasElement): TResolverBaseType; virtual;
|
||||
function IsElementSkipped(El: TPasElement): boolean; virtual;
|
||||
@ -6818,7 +6818,7 @@ end;
|
||||
procedure TPasResolver.ResolveImplCaseOf(CaseOf: TPasImplCaseOf);
|
||||
type
|
||||
TRangeItem = record
|
||||
RangeStart, RangeEnd: MaxPrecInt;
|
||||
RangeStart, RangeEnd: TMaxPrecInt;
|
||||
Expr: TPasExpr;
|
||||
aString: UnicodeString;
|
||||
// Note: for case-of-string:
|
||||
@ -6888,7 +6888,7 @@ type
|
||||
end;
|
||||
end;
|
||||
|
||||
function AddRangeItem(Values: TFPList; const RangeStart, RangeEnd: MaxPrecInt;
|
||||
function AddRangeItem(Values: TFPList; const RangeStart, RangeEnd: TMaxPrecInt;
|
||||
Expr: TPasExpr): PRangeItem;
|
||||
begin
|
||||
New(Result);
|
||||
@ -6927,7 +6927,7 @@ type
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function AddStringRange(CharStart, CharEnd: MaxPrecInt): boolean;
|
||||
function AddStringRange(CharStart, CharEnd: TMaxPrecInt): boolean;
|
||||
var
|
||||
i, o: Integer;
|
||||
s: UnicodeString;
|
||||
@ -6957,7 +6957,7 @@ type
|
||||
end;
|
||||
|
||||
var
|
||||
RangeStart, RangeEnd: MaxPrecInt;
|
||||
RangeStart, RangeEnd: TMaxPrecInt;
|
||||
i: Integer;
|
||||
Item: PRangeItem;
|
||||
begin
|
||||
@ -6981,7 +6981,7 @@ type
|
||||
// Note: when FPC compares int64 with qword it converts the qword to an int64
|
||||
if TResEvalUInt(Value).UInt>HighIntAsUInt then
|
||||
ExprEvaluator.EmitRangeCheckConst(20180424212414,Value.AsString,
|
||||
'0',IntToStr(High(MaxPrecInt)),Expr,mtError);
|
||||
'0',IntToStr(High(TMaxPrecInt)),Expr,mtError);
|
||||
RangeStart:=TResEvalUInt(Value).UInt;
|
||||
RangeEnd:=RangeStart;
|
||||
end;
|
||||
@ -7023,7 +7023,7 @@ type
|
||||
// Note: when FPC compares int64 with qword it converts the qword to an int64
|
||||
if TResEvalRangeUInt(Value).RangeEnd>HighIntAsUInt then
|
||||
ExprEvaluator.EmitRangeCheckConst(20180424212648,Value.AsString,
|
||||
'0',IntToStr(High(MaxPrecInt)),Expr,mtError);
|
||||
'0',IntToStr(High(TMaxPrecInt)),Expr,mtError);
|
||||
RangeStart:=TResEvalRangeUInt(Value).RangeStart;
|
||||
RangeEnd:=TResEvalRangeUInt(Value).RangeEnd;
|
||||
end;
|
||||
@ -11674,9 +11674,9 @@ end;
|
||||
function TPasResolver.EvalBaseTypeCast(Params: TParamsExpr;
|
||||
bt: TResolverBaseType): TResEvalvalue;
|
||||
|
||||
procedure TCFloatToInt(Value: TResEvalValue; Flo: MaxPrecFloat);
|
||||
procedure TCFloatToInt(Value: TResEvalValue; Flo: TMaxPrecFloat);
|
||||
var
|
||||
Int, MinIntVal, MaxIntVal: MaxPrecInt;
|
||||
Int, MinIntVal, MaxIntVal: TMaxPrecInt;
|
||||
begin
|
||||
if bt in (btAllInteger-[btQWord]) then
|
||||
begin
|
||||
@ -11747,9 +11747,9 @@ function TPasResolver.EvalBaseTypeCast(Params: TParamsExpr;
|
||||
|
||||
var
|
||||
Value: TResEvalValue;
|
||||
Int: MaxPrecInt;
|
||||
Int: TMaxPrecInt;
|
||||
MinIntVal, MaxIntVal: int64;
|
||||
Flo: MaxPrecFloat;
|
||||
Flo: TMaxPrecFloat;
|
||||
c: Char;
|
||||
w: WideChar;
|
||||
begin
|
||||
@ -11768,7 +11768,7 @@ begin
|
||||
begin
|
||||
// int to qword
|
||||
{$R-}
|
||||
Result:=TResEvalUInt.CreateValue(MaxPrecUInt(Int));
|
||||
Result:=TResEvalUInt.CreateValue(TMaxPrecUInt(Int));
|
||||
{$IFDEF RangeCheckOn}{$R+}{$ENDIF}
|
||||
end
|
||||
else if bt in (btAllInteger-[btQWord]) then
|
||||
@ -12655,7 +12655,7 @@ var
|
||||
Value: TResEvalValue;
|
||||
EnumType: TPasEnumType;
|
||||
aSet: TResEvalSet;
|
||||
Int: MaxPrecInt;
|
||||
Int: TMaxPrecInt;
|
||||
bt: TResolverBaseType;
|
||||
MinInt, MaxInt: int64;
|
||||
i: Integer;
|
||||
@ -13600,7 +13600,7 @@ var
|
||||
i: Integer;
|
||||
ArrayEl: TPasArrayType;
|
||||
bt: TResolverBaseType;
|
||||
MinInt, MaxInt: MaxPrecInt;
|
||||
MinInt, MaxInt: TMaxPrecInt;
|
||||
begin
|
||||
Evaluated:=nil;
|
||||
Param:=Params.Params[0];
|
||||
@ -16111,7 +16111,7 @@ var
|
||||
LRangeValue, RValue: TResEvalValue;
|
||||
MinVal, MaxVal: int64;
|
||||
RangeExpr: TBinaryExpr;
|
||||
Int: MaxPrecInt;
|
||||
Int: TMaxPrecInt;
|
||||
C: TClass;
|
||||
EnumType: TPasEnumType;
|
||||
bt: TResolverBaseType;
|
||||
@ -16193,9 +16193,9 @@ begin
|
||||
fExprEvaluator.EmitRangeCheckConst(20170530093126,
|
||||
IntToStr(TResEvalInt(RValue).Int),MinVal,MaxVal,RHS);
|
||||
revkUInt:
|
||||
if (TResEvalUInt(RValue).UInt>High(MaxPrecInt))
|
||||
or (MinVal>MaxPrecInt(TResEvalUInt(RValue).UInt))
|
||||
or (MaxVal<MaxPrecInt(TResEvalUInt(RValue).UInt)) then
|
||||
if (TResEvalUInt(RValue).UInt>High(TMaxPrecInt))
|
||||
or (MinVal>TMaxPrecInt(TResEvalUInt(RValue).UInt))
|
||||
or (MaxVal<TMaxPrecInt(TResEvalUInt(RValue).UInt)) then
|
||||
fExprEvaluator.EmitRangeCheckConst(20170530093616,
|
||||
IntToStr(TResEvalUInt(RValue).UInt),IntToStr(MinVal),IntToStr(MaxVal),RHS);
|
||||
revkFloat:
|
||||
@ -20027,7 +20027,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TPasResolver.GetRangeLength(RangeExpr: TPasExpr): MaxPrecInt;
|
||||
function TPasResolver.GetRangeLength(RangeExpr: TPasExpr): TMaxPrecInt;
|
||||
var
|
||||
Range: TResEvalValue;
|
||||
begin
|
||||
@ -20259,7 +20259,7 @@ begin
|
||||
end;
|
||||
|
||||
function TPasResolver.GetIntegerRange(bt: TResolverBaseType; out MinVal,
|
||||
MaxVal: MaxPrecInt): boolean;
|
||||
MaxVal: TMaxPrecInt): boolean;
|
||||
begin
|
||||
Result:=true;
|
||||
if bt=btExtended then bt:=BaseTypeExtended;
|
||||
@ -20327,10 +20327,10 @@ begin
|
||||
RaiseRangeCheck(20170420100336,ErrorEl);
|
||||
end;
|
||||
|
||||
function TPasResolver.GetSmallestIntegerBaseType(MinVal, MaxVal: MaxPrecInt
|
||||
function TPasResolver.GetSmallestIntegerBaseType(MinVal, MaxVal: TMaxPrecInt
|
||||
): TResolverBaseType;
|
||||
var
|
||||
V: MaxPrecInt;
|
||||
V: TMaxPrecInt;
|
||||
begin
|
||||
if MinVal>MaxVal then
|
||||
MinVal:=MaxVal;
|
||||
|
@ -273,10 +273,12 @@ type
|
||||
FTokenRingCur: Integer; // index of current token in FTokenBuffer
|
||||
FTokenRingStart: Integer; // first valid ring index in FTokenBuffer, if FTokenRingStart=FTokenRingEnd the ring is empty
|
||||
FTokenRingEnd: Integer; // first invalid ring index in FTokenBuffer
|
||||
{$ifdef VerbosePasParser}
|
||||
FDumpIndent : String;
|
||||
procedure DumpCurToken(Const Msg : String; IndentAction : TIndentAction = iaNone);
|
||||
{$endif}
|
||||
function CheckOverloadList(AList: TFPList; AName: String; out OldMember: TPasElement): TPasOverloadedProc;
|
||||
function DoCheckHint(Element: TPasElement): Boolean;
|
||||
procedure DumpCurToken(Const Msg : String; IndentAction : TIndentAction = iaNone);
|
||||
function GetCurrentModeSwitches: TModeSwitches;
|
||||
Procedure SetCurrentModeSwitches(AValue: TModeSwitches);
|
||||
function GetVariableModifiers(Parent: TPasElement;
|
||||
@ -2425,7 +2427,9 @@ begin
|
||||
AllowedBinaryOps:=BinaryOP;
|
||||
if Not AllowEqual then
|
||||
Exclude(AllowedBinaryOps,tkEqual);
|
||||
{$ifdef VerbosePasParser}
|
||||
//DumpCurToken('Entry',iaIndent);
|
||||
{$endif}
|
||||
Result:=nil;
|
||||
ExpStack := TFPList.Create;
|
||||
SetLength(OpStack,4);
|
||||
@ -2543,10 +2547,12 @@ begin
|
||||
Result.Parent:=AParent;
|
||||
|
||||
finally
|
||||
{if Not Assigned(Result) then
|
||||
{$ifdef VerbosePasParser}
|
||||
if Not Assigned(Result) then
|
||||
DumpCurToken('Exiting (no result)',iaUndent)
|
||||
else
|
||||
DumpCurtoken('Exiting (Result: "'+Result.GetDeclaration(true)+'") ',iaUndent);}
|
||||
DumpCurtoken('Exiting (Result: "'+Result.GetDeclaration(true)+'") ',iaUndent);
|
||||
{$endif}
|
||||
if not Assigned(Result) then begin
|
||||
// expression error!
|
||||
for i:=0 to ExpStack.Count-1 do
|
||||
@ -4958,7 +4964,9 @@ begin
|
||||
IsCurTokenHint() or
|
||||
TokenIsCallingConvention(CurTokenString,cc) or
|
||||
(CurToken=tkIdentifier) and (CompareText(CurTokenText,'alias')=0));
|
||||
// DumpCurToken('Done '+IntToStr(Ord(Done)));
|
||||
{$ifdef VerbosePasParser}
|
||||
DumpCurToken('Done '+IntToStr(Ord(Done)));
|
||||
{$endif}
|
||||
UngetToken;
|
||||
end;
|
||||
|
||||
@ -6098,6 +6106,7 @@ begin
|
||||
Until Done;
|
||||
end;
|
||||
|
||||
{$ifdef VerbosePasParser}
|
||||
procedure TPasParser.DumpCurToken(const Msg: String; IndentAction: TIndentAction
|
||||
);
|
||||
begin
|
||||
@ -6114,6 +6123,7 @@ begin
|
||||
{$endif}
|
||||
{AllowWriteln-}
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function TPasParser.GetCurrentModeSwitches: TModeSwitches;
|
||||
begin
|
||||
|
@ -1511,7 +1511,7 @@ type
|
||||
Function GetExpressionValueType(El: TPasExpr; AContext: TConvertContext ): TJSType; virtual;
|
||||
Function GetPasIdentValueType(AName: String; AContext: TConvertContext): TJSType; virtual;
|
||||
Function ComputeConstString(Expr: TPasExpr; AContext: TConvertContext; NotEmpty: boolean): String; virtual;
|
||||
Function IsLiteralInteger(El: TJSElement; out Number: MaxPrecInt): boolean;
|
||||
Function IsLiteralInteger(El: TJSElement; out Number: TMaxPrecInt): boolean;
|
||||
Function IsLiteralNumber(El: TJSElement; out n: TJSNumber): boolean;
|
||||
// Name mangling
|
||||
Function GetOverloadName(El: TPasElement; AContext: TConvertContext): string;
|
||||
@ -1577,8 +1577,8 @@ type
|
||||
Procedure ConvertCharLiteralToInt(Lit: TJSLiteral; ErrorEl: TPasElement; AContext: TConvertContext); virtual;
|
||||
Function ClonePrimaryExpression(El: TJSPrimaryExpression; Src: TPasElement): TJSPrimaryExpression;
|
||||
// simple JS expressions
|
||||
Function CreateMulNumber(El: TPasElement; JS: TJSElement; n: MaxPrecInt): TJSElement; virtual;
|
||||
Function CreateDivideNumber(El: TPasElement; JS: TJSElement; n: MaxPrecInt): TJSElement; virtual;
|
||||
Function CreateMulNumber(El: TPasElement; JS: TJSElement; n: TMaxPrecInt): TJSElement; virtual;
|
||||
Function CreateDivideNumber(El: TPasElement; JS: TJSElement; n: TMaxPrecInt): TJSElement; virtual;
|
||||
Function CreateMathFloor(El: TPasElement; JS: TJSElement): TJSElement; virtual;
|
||||
Function CreateDotExpression(aParent: TPasElement; Left, Right: TJSElement;
|
||||
CheckRightIntfRef: boolean = false): TJSElement; virtual;
|
||||
@ -1786,7 +1786,7 @@ type
|
||||
otSIntDouble, // 6 NativeInt
|
||||
otUIntDouble // 7 NativeUInt
|
||||
);
|
||||
Function GetOrdType(MinValue, MaxValue: MaxPrecInt; ErrorEl: TPasElement): TOrdType; virtual;
|
||||
Function GetOrdType(MinValue, MaxValue: TMaxPrecInt; ErrorEl: TPasElement): TOrdType; virtual;
|
||||
Public
|
||||
Constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -5588,7 +5588,7 @@ begin
|
||||
end;
|
||||
|
||||
function TPasToJSConverter.IsLiteralInteger(El: TJSElement; out
|
||||
Number: MaxPrecInt): boolean;
|
||||
Number: TMaxPrecInt): boolean;
|
||||
var
|
||||
Value: TJSValue;
|
||||
begin
|
||||
@ -7353,7 +7353,7 @@ var
|
||||
Arg, ArrJS: TJSElement;
|
||||
OldAccess: TCtxAccess;
|
||||
Ranges: TPasExprArray;
|
||||
Int: MaxPrecInt;
|
||||
Int: TMaxPrecInt;
|
||||
Param: TPasExpr;
|
||||
JSAdd: TJSAdditiveExpression;
|
||||
LowRg: TResEvalValue;
|
||||
@ -8522,7 +8522,7 @@ var
|
||||
JSBaseType:=JSBaseTypeData.JSBaseType;
|
||||
end;
|
||||
|
||||
function CreateBitWiseAnd(Value: TJSElement; const Mask: MaxPrecInt; Shift: integer): TJSElement;
|
||||
function CreateBitWiseAnd(Value: TJSElement; const Mask: TMaxPrecInt; Shift: integer): TJSElement;
|
||||
// ig sign=false: Value & Mask
|
||||
// if sign=true: Value & Mask << ZeroBits >> ZeroBits
|
||||
var
|
||||
@ -8570,7 +8570,7 @@ var
|
||||
AddExpr: TJSAdditiveExpressionPlus;
|
||||
TypeEl: TPasType;
|
||||
C: TClass;
|
||||
Int, MinVal, MaxVal: MaxPrecInt;
|
||||
Int, MinVal, MaxVal: TMaxPrecInt;
|
||||
aResolver: TPas2JSResolver;
|
||||
ShiftEx: TJSURShiftExpression;
|
||||
begin
|
||||
@ -8954,7 +8954,7 @@ var
|
||||
ParamResolved: TPasResolverResult;
|
||||
Ranges: TPasExprArray;
|
||||
Call: TJSCallExpression;
|
||||
RgLen: MaxPrecInt;
|
||||
RgLen: TMaxPrecInt;
|
||||
begin
|
||||
Result:=nil;
|
||||
Param:=El.Params[0];
|
||||
@ -9477,7 +9477,7 @@ var
|
||||
Value: TResEvalValue;
|
||||
Call: TJSCallExpression;
|
||||
MinusExpr: TJSAdditiveExpressionMinus;
|
||||
MinVal, MaxVal: MaxPrecInt;
|
||||
MinVal, MaxVal: TMaxPrecInt;
|
||||
begin
|
||||
Result:=nil;
|
||||
if AContext.Resolver=nil then
|
||||
@ -10376,7 +10376,7 @@ var
|
||||
Param: TPasExpr;
|
||||
TypeEl: TPasType;
|
||||
Value: TResEvalValue;
|
||||
MinVal, MaxVal: MaxPrecInt;
|
||||
MinVal, MaxVal: TMaxPrecInt;
|
||||
C: TClass;
|
||||
begin
|
||||
Result:=nil;
|
||||
@ -11889,7 +11889,7 @@ var
|
||||
TIObj: TJSObjectLiteral;
|
||||
Call: TJSCallExpression;
|
||||
MinVal, MaxVal: TResEvalValue;
|
||||
MinInt, MaxInt: MaxPrecInt;
|
||||
MinInt, MaxInt: TMaxPrecInt;
|
||||
OrdType: TOrdType;
|
||||
TIProp: TJSObjectLiteralElement;
|
||||
fn: TPas2JSBuiltInName;
|
||||
@ -12109,7 +12109,7 @@ var
|
||||
ElType: TPasType;
|
||||
RangeEl: TPasExpr;
|
||||
Call: TJSCallExpression;
|
||||
RgLen, RangeEnd: MaxPrecInt;
|
||||
RgLen, RangeEnd: TMaxPrecInt;
|
||||
List: TJSStatementList;
|
||||
Func: TJSFunctionDeclarationStatement;
|
||||
Src: TJSSourceElements;
|
||||
@ -12264,10 +12264,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TPasToJSConverter.GetOrdType(MinValue, MaxValue: MaxPrecInt;
|
||||
function TPasToJSConverter.GetOrdType(MinValue, MaxValue: TMaxPrecInt;
|
||||
ErrorEl: TPasElement): TOrdType;
|
||||
var
|
||||
V: MaxPrecInt;
|
||||
V: TMaxPrecInt;
|
||||
begin
|
||||
if MinValue<0 then
|
||||
begin
|
||||
@ -12373,7 +12373,7 @@ var
|
||||
BodyJS.A:=FirstSt;
|
||||
end;
|
||||
|
||||
procedure AddRangeCheck(Arg: TPasArgument; MinVal, MaxVal: MaxPrecInt;
|
||||
procedure AddRangeCheck(Arg: TPasArgument; MinVal, MaxVal: TMaxPrecInt;
|
||||
RTLFunc: TPas2JSBuiltInName);
|
||||
var
|
||||
Call: TJSCallExpression;
|
||||
@ -12431,7 +12431,7 @@ Var
|
||||
Call: TJSCallExpression;
|
||||
ClassPath: String;
|
||||
ArgResolved: TPasResolverResult;
|
||||
MinVal, MaxVal: MaxPrecInt;
|
||||
MinVal, MaxVal: TMaxPrecInt;
|
||||
Lit: TJSLiteral;
|
||||
ConstSrcElems: TJSSourceElements;
|
||||
ArgTypeEl: TPasType;
|
||||
@ -13986,7 +13986,7 @@ var
|
||||
Path: String;
|
||||
FuncContext: TFunctionContext;
|
||||
DotExpr: TJSDotMemberExpression;
|
||||
i: MaxPrecInt;
|
||||
i: TMaxPrecInt;
|
||||
JSExpr: TJSElement;
|
||||
begin
|
||||
if ArrayExpr is TJSArrayLiteral then
|
||||
@ -15105,7 +15105,7 @@ function TPasToJSConverter.ConvertAssignStatement(El: TPasImplAssign;
|
||||
end;
|
||||
|
||||
function CreateRangeCheck(AssignSt: TJSElement;
|
||||
MinVal, MaxVal: MaxPrecInt; RTLFunc: TPas2JSBuiltInName): TJSElement;
|
||||
MinVal, MaxVal: TMaxPrecInt; RTLFunc: TPas2JSBuiltInName): TJSElement;
|
||||
var
|
||||
Call: TJSCallExpression;
|
||||
begin
|
||||
@ -15165,7 +15165,7 @@ Var
|
||||
Flags: TPasResolverComputeFlags;
|
||||
LeftIsProcType, NeedClone: Boolean;
|
||||
Call: TJSCallExpression;
|
||||
MinVal, MaxVal: MaxPrecInt;
|
||||
MinVal, MaxVal: TMaxPrecInt;
|
||||
RightTypeEl, LeftTypeEl: TPasType;
|
||||
aResolver: TPas2JSResolver;
|
||||
NewMemE, NewME: TJSNewMemberExpression;
|
||||
@ -15651,7 +15651,7 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetOrd(Value: TResEvalValue; ErrorEl: TPasElement): MaxPrecInt; overload;
|
||||
function GetOrd(Value: TResEvalValue; ErrorEl: TPasElement): TMaxPrecInt; overload;
|
||||
var
|
||||
OrdValue: TResEvalValue;
|
||||
begin
|
||||
@ -15667,7 +15667,7 @@ var
|
||||
ReleaseEvalValue(OrdValue);
|
||||
end;
|
||||
|
||||
function GetEnumValue(EnumType: TPasEnumType; Int: MaxPrecInt): TResEvalValue; overload;
|
||||
function GetEnumValue(EnumType: TPasEnumType; Int: TMaxPrecInt): TResEvalValue; overload;
|
||||
begin
|
||||
if (coEnumNumbers in Options) or (Int<0) or (Int>=EnumType.Values.Count) then
|
||||
Result:=TResEvalInt.CreateValue(Int)
|
||||
@ -15679,7 +15679,7 @@ var
|
||||
FuncContext: TConvertContext;
|
||||
VarResolved, InResolved: TPasResolverResult;
|
||||
StartValue, EndValue, InValue: TResEvalValue;
|
||||
StartInt, EndInt: MaxPrecInt;
|
||||
StartInt, EndInt: TMaxPrecInt;
|
||||
HasLoopVar, HasEndVar, HasInVar: Boolean;
|
||||
InKind: TInKind;
|
||||
ForScope: TPasForLoopScope;
|
||||
@ -17094,7 +17094,7 @@ begin
|
||||
end;
|
||||
|
||||
function TPasToJSConverter.CreateMulNumber(El: TPasElement; JS: TJSElement;
|
||||
n: MaxPrecInt): TJSElement;
|
||||
n: TMaxPrecInt): TJSElement;
|
||||
// create JS*n
|
||||
var
|
||||
Mul: TJSMultiplicativeExpressionMul;
|
||||
@ -17141,7 +17141,7 @@ begin
|
||||
end;
|
||||
|
||||
function TPasToJSConverter.CreateDivideNumber(El: TPasElement; JS: TJSElement;
|
||||
n: MaxPrecInt): TJSElement;
|
||||
n: TMaxPrecInt): TJSElement;
|
||||
// create JS/n
|
||||
var
|
||||
Mul: TJSMultiplicativeExpressionDiv;
|
||||
|
@ -1035,10 +1035,10 @@ function ComparePCUSrcFiles(File1, File2: Pointer): integer;
|
||||
function ComparePCUFilerElementRef(Ref1, Ref2: Pointer): integer;
|
||||
function CompareElWithPCUFilerElementRef(El, Ref: Pointer): integer;
|
||||
|
||||
function EncodeVLQ(i: MaxPrecInt): string; overload;
|
||||
function EncodeVLQ(i: MaxPrecUInt): string; overload;
|
||||
function DecodeVLQ(const s: string): MaxPrecInt; // base256 Variable Length Quantity
|
||||
function DecodeVLQ(var p: PByte): MaxPrecInt; // base256 Variable Length Quantity
|
||||
function EncodeVLQ(i: TMaxPrecInt): string; overload;
|
||||
function EncodeVLQ(i: TMaxPrecUInt): string; overload;
|
||||
function DecodeVLQ(const s: string): TMaxPrecInt; // base256 Variable Length Quantity
|
||||
function DecodeVLQ(var p: PByte): TMaxPrecInt; // base256 Variable Length Quantity
|
||||
|
||||
function ComputeChecksum(p: PChar; Cnt: integer): TPCUSourceFileChecksum;
|
||||
function crc32(crc: cardinal; buf: Pbyte; len: cardinal): cardinal;
|
||||
@ -1086,7 +1086,7 @@ begin
|
||||
Result:=ComparePointer(Element,Reference.Element);
|
||||
end;
|
||||
|
||||
function EncodeVLQ(i: MaxPrecInt): string;
|
||||
function EncodeVLQ(i: TMaxPrecInt): string;
|
||||
{ Convert signed number to base256-VLQ:
|
||||
Each byte has 8bit, where the least significant bit is the continuation bit
|
||||
(1=there is a next byte).
|
||||
@ -1104,9 +1104,9 @@ begin
|
||||
digits:=0;
|
||||
if i<0 then
|
||||
begin
|
||||
if i=Low(MaxPrecInt) then
|
||||
if i=Low(TMaxPrecInt) then
|
||||
begin
|
||||
Result:=EncodeVLQ(High(MaxPrecInt)+1);
|
||||
Result:=EncodeVLQ(High(TMaxPrecInt)+1);
|
||||
Result[1]:=chr(ord(Result[1]) or 1);
|
||||
exit;
|
||||
end;
|
||||
@ -1128,7 +1128,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function EncodeVLQ(i: MaxPrecUInt): string;
|
||||
function EncodeVLQ(i: TMaxPrecUInt): string;
|
||||
var
|
||||
digits: integer;
|
||||
begin
|
||||
@ -1147,7 +1147,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function DecodeVLQ(const s: string): MaxPrecInt;
|
||||
function DecodeVLQ(const s: string): TMaxPrecInt;
|
||||
var
|
||||
p: PByte;
|
||||
begin
|
||||
@ -1159,7 +1159,7 @@ begin
|
||||
raise EConvertError.Create('DecodeVLQ waste');
|
||||
end;
|
||||
|
||||
function DecodeVLQ(var p: PByte): MaxPrecInt;
|
||||
function DecodeVLQ(var p: PByte): TMaxPrecInt;
|
||||
{ Convert base256-VLQ to signed number,
|
||||
For the fomat see EncodeVLQ
|
||||
}
|
||||
@ -1170,7 +1170,7 @@ function DecodeVLQ(var p: PByte): MaxPrecInt;
|
||||
end;
|
||||
|
||||
const
|
||||
MaxShift = 63; // actually log2(High(MaxPrecInt))
|
||||
MaxShift = 63; // actually log2(High(TMaxPrecInt))
|
||||
var
|
||||
digit, Shift: Integer;
|
||||
Negated: Boolean;
|
||||
@ -1186,7 +1186,7 @@ begin
|
||||
inc(p);
|
||||
if Shift>MaxShift then
|
||||
RaiseInvalid;
|
||||
inc(Result,MaxPrecInt(digit and %1111111) shl Shift);
|
||||
inc(Result,TMaxPrecInt(digit and %1111111) shl Shift);
|
||||
inc(Shift,7);
|
||||
end;
|
||||
if Negated then
|
||||
|
@ -1541,11 +1541,11 @@ end;
|
||||
|
||||
procedure TTestPrecompile.Test_Base256VLQ;
|
||||
|
||||
procedure Test(i: MaxPrecInt);
|
||||
procedure Test(i: TMaxPrecInt);
|
||||
var
|
||||
s: String;
|
||||
p: PByte;
|
||||
j: MaxPrecInt;
|
||||
j: TMaxPrecInt;
|
||||
begin
|
||||
s:=EncodeVLQ(i);
|
||||
p:=PByte(s);
|
||||
@ -1554,7 +1554,7 @@ procedure TTestPrecompile.Test_Base256VLQ;
|
||||
Fail('Encode/DecodeVLQ OrigIndex='+IntToStr(i)+' Code="'+s+'" NewIndex='+IntToStr(j));
|
||||
end;
|
||||
|
||||
procedure TestStr(i: MaxPrecInt; Expected: string);
|
||||
procedure TestStr(i: TMaxPrecInt; Expected: string);
|
||||
var
|
||||
Actual: String;
|
||||
begin
|
||||
@ -1570,11 +1570,11 @@ begin
|
||||
TestStr(-1,#3);
|
||||
for i:=-8200 to 8200 do
|
||||
Test(i);
|
||||
Test(High(MaxPrecInt));
|
||||
Test(High(MaxPrecInt)-1);
|
||||
Test(Low(MaxPrecInt)+2);
|
||||
Test(Low(MaxPrecInt)+1);
|
||||
//Test(Low(MaxPrecInt)); such a high number is not needed by pastojs
|
||||
Test(High(TMaxPrecInt));
|
||||
Test(High(TMaxPrecInt)-1);
|
||||
Test(Low(TMaxPrecInt)+2);
|
||||
Test(Low(TMaxPrecInt)+1);
|
||||
//Test(Low(TMaxPrecInt)); such a high number is not needed by pastojs
|
||||
end;
|
||||
|
||||
procedure TTestPrecompile.TestPC_EmptyUnit;
|
||||
|
Loading…
Reference in New Issue
Block a user