mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 02:29:12 +02:00
pastojs: test range check string[] by reference
git-svn-id: trunk@38838 -
This commit is contained in:
parent
3c4b206bc5
commit
3bc75e6627
@ -285,6 +285,7 @@ Works:
|
||||
enumrange:=, enumrange+=, char:=, char+=, charrange:=, charrange+=
|
||||
- procedure argument int, enum, intrange, enumrange, char, charrange
|
||||
- array[index1,index2,...] read and assign
|
||||
- string[index] read and assign
|
||||
- Interfaces:
|
||||
- autogenerate GUID
|
||||
- method resolution
|
||||
@ -343,9 +344,8 @@ ToDos:
|
||||
v:=a[0] gives Local variable "a" is assigned but never used
|
||||
- setlength(dynarray) modeswitch to create a copy
|
||||
- range checks:
|
||||
- string[index]
|
||||
- case duplicates
|
||||
- typecast longint(highprecint) -> value & $ffffffff
|
||||
- typecast byte(longword) -> value & $ff
|
||||
- static arrays
|
||||
- a[] of record
|
||||
- clone multi dim static array
|
||||
|
@ -20108,7 +20108,7 @@ begin
|
||||
StartProgram(false);
|
||||
Add([
|
||||
'{$R+}',
|
||||
'procedure DoIt;',
|
||||
'procedure DoIt(var h: string);',
|
||||
'var',
|
||||
' s: string;',
|
||||
' i: longint;',
|
||||
@ -20116,18 +20116,20 @@ begin
|
||||
'begin',
|
||||
' c:=s[1];',
|
||||
' s[i]:=s[i];',
|
||||
' h[i]:=h[i];',
|
||||
'end;',
|
||||
'begin',
|
||||
'']);
|
||||
ConvertProgram;
|
||||
CheckSource('TestRangeChecks_StringIndex',
|
||||
LinesToStr([ // statements
|
||||
'this.DoIt = function () {',
|
||||
'this.DoIt = function (h) {',
|
||||
' var s = "";',
|
||||
' var i = 0;',
|
||||
' var c = "";',
|
||||
' c = rtl.rcc(rtl.rcCharAt(s, 0), 0, 65535);',
|
||||
' s = rtl.rcSetCharAt(s, i - 1, rtl.rcCharAt(s, i - 1));',
|
||||
' h.set(rtl.rcSetCharAt(h.get(), i - 1, rtl.rcCharAt(h.get(), i - 1)));',
|
||||
'};',
|
||||
'']),
|
||||
LinesToStr([ // $mod.$main
|
||||
|
Loading…
Reference in New Issue
Block a user