mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-17 08:50:42 +01:00
codetools: generate local var for Length() with type SizeInt
git-svn-id: trunk@63800 -
This commit is contained in:
parent
7fefade33f
commit
da8c2d75b5
@ -271,7 +271,8 @@ type
|
|||||||
xtCompilerFunc,// SUCC, PREC, LOW, HIGH, ORD, LENGTH, COPY (1.1), ...
|
xtCompilerFunc,// SUCC, PREC, LOW, HIGH, ORD, LENGTH, COPY (1.1), ...
|
||||||
xtVariant, // variant
|
xtVariant, // variant
|
||||||
xtJSValue, // jsvalue only in Pas2JS, similar to variant
|
xtJSValue, // jsvalue only in Pas2JS, similar to variant
|
||||||
xtNil // nil = pointer, class, procedure, method, ...
|
xtNil, // nil = pointer, class, procedure, method, ...
|
||||||
|
xtSizeInt // SizeInt for Length intrinsic
|
||||||
);
|
);
|
||||||
// Do not define: TExpressionTypeDescs = set of TExpressionTypeDesc;
|
// Do not define: TExpressionTypeDescs = set of TExpressionTypeDesc;
|
||||||
// There are too many enums, so the set would be big and slow
|
// There are too many enums, so the set would be big and slow
|
||||||
@ -322,7 +323,8 @@ var
|
|||||||
'CompilerFunc',
|
'CompilerFunc',
|
||||||
'Variant',
|
'Variant',
|
||||||
'JSValue',
|
'JSValue',
|
||||||
'Nil'
|
'Nil',
|
||||||
|
'SizeInt'
|
||||||
);
|
);
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -334,7 +336,7 @@ const
|
|||||||
xtAllIdentPredefinedTypes = xtAllIdentTypes - [xtContext];
|
xtAllIdentPredefinedTypes = xtAllIdentTypes - [xtContext];
|
||||||
xtAllIntegerTypes = [xtInt64, xtQWord, xtConstOrdInteger, xtLongint,
|
xtAllIntegerTypes = [xtInt64, xtQWord, xtConstOrdInteger, xtLongint,
|
||||||
xtLongWord, xtWord, xtCardinal, xtSmallInt, xtShortInt,
|
xtLongWord, xtWord, xtCardinal, xtSmallInt, xtShortInt,
|
||||||
xtByte,xtNativeInt,xtNativeUInt];
|
xtByte,xtNativeInt,xtNativeUInt,xtSizeInt];
|
||||||
xtAllBooleanTypes = [xtBoolean, xtByteBool, xtWordBool, xtLongBool,xtQWordBool];
|
xtAllBooleanTypes = [xtBoolean, xtByteBool, xtWordBool, xtLongBool,xtQWordBool];
|
||||||
xtAllRealTypes = [xtReal, xtConstReal, xtSingle, xtDouble,
|
xtAllRealTypes = [xtReal, xtConstReal, xtSingle, xtDouble,
|
||||||
xtExtended, xtCExtended, xtCurrency, xtComp];
|
xtExtended, xtCExtended, xtCurrency, xtComp];
|
||||||
@ -10599,7 +10601,7 @@ begin
|
|||||||
else if (CompareIdentifiers(IdentPos,'LENGTH')=0) then
|
else if (CompareIdentifiers(IdentPos,'LENGTH')=0) then
|
||||||
begin
|
begin
|
||||||
if ParamList.Count<>1 then exit;
|
if ParamList.Count<>1 then exit;
|
||||||
Result.Desc:=xtConstOrdInteger;
|
Result.Desc:=xtSizeInt;
|
||||||
end
|
end
|
||||||
else if (CompareIdentifiers(IdentPos,'COPY')=0) then
|
else if (CompareIdentifiers(IdentPos,'COPY')=0) then
|
||||||
begin
|
begin
|
||||||
@ -13580,7 +13582,8 @@ begin
|
|||||||
xtShortInt,
|
xtShortInt,
|
||||||
xtByte,
|
xtByte,
|
||||||
xtNativeInt,
|
xtNativeInt,
|
||||||
xtNativeUInt:
|
xtNativeUInt,
|
||||||
|
xtSizeInt:
|
||||||
Result:=ExpressionTypeDescNames[ExprType.Desc];
|
Result:=ExpressionTypeDescNames[ExprType.Desc];
|
||||||
|
|
||||||
xtBoolean,
|
xtBoolean,
|
||||||
|
|||||||
@ -7,7 +7,7 @@ uses
|
|||||||
|
|
||||||
procedure DoIt(s: string);
|
procedure DoIt(s: string);
|
||||||
begin
|
begin
|
||||||
i{guesstype:integer}:=length(s);
|
i{guesstype:sizeint}:=length(s);
|
||||||
d{guesstype:string}:=copy(s,1,3);
|
d{guesstype:string}:=copy(s,1,3);
|
||||||
i{guesstype:integer}:=default(integer);
|
i{guesstype:integer}:=default(integer);
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user