summary refs log tree commit diff stats
path: root/lib/pure/collections
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2018-12-06 15:42:44 -0800
committerTimothee Cour <timothee.cour2@gmail.com>2018-12-09 16:50:45 -0800
commitf3ecc15a94c12b149f0665d250af1d71dd128721 (patch)
tree5ddd43e4b49bbd6ef72625fdbcd0c5864dc74748 /lib/pure/collections
parent7a66616d741106d4c18ce2e8f843a8b5d31f6025 (diff)
downloadNim-f3ecc15a94c12b149f0665d250af1d71dd128721.tar.gz
refs #9880 show index and bound in lots of `index out of bounds` errors
Diffstat (limited to 'lib/pure/collections')
-rw-r--r--lib/pure/collections/sharedstrings.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pure/collections/sharedstrings.nim b/lib/pure/collections/sharedstrings.nim
index 7e9de4b73..b283cd4b1 100644
--- a/lib/pure/collections/sharedstrings.nim
+++ b/lib/pure/collections/sharedstrings.nim
@@ -12,6 +12,8 @@
 type
   UncheckedCharArray = UncheckedArray[char]
 
+import system/helpers2
+
 type
   Buffer = ptr object
     refcount: int
@@ -49,11 +51,11 @@ proc len*(s: SharedString): int = s.len
 
 proc `[]`*(s: SharedString; i: Natural): char =
   if i < s.len: result = s.buffer.data[i+s.first]
-  else: raise newException(IndexError, "index out of bounds")
+  else: raise newException(IndexError, formatErrorIndexBound(i, s.len-1))
 
 proc `[]=`*(s: var SharedString; i: Natural; value: char) =
   if i < s.len: s.buffer.data[i+s.first] = value
-  else: raise newException(IndexError, "index out of bounds")
+  else: raise newException(IndexError, formatErrorIndexBound(i, s.len-1))
 
 proc `[]`*(s: SharedString; ab: HSlice[int, int]): SharedString =
   #incRef(src.buffer)
688bb0623c6a2'>0128bee7 ^
02cf8f61 ^
eaaeed3d ^

0c0b9489 ^
0128bee7 ^
01c89bb5 ^
d46a05a8 ^
eaaeed3d ^
1c1b6c31 ^
3de15ddd ^
d528952a ^
3de15ddd ^
d88232a3 ^
a1d7ed6e ^
9b83f114 ^
871c502d ^
1c1b6c31 ^
16246965 ^

20f94973 ^
a1d7ed6e ^
0c0b9489 ^
1c1b6c31 ^
9506fb8e ^
6f43de0a ^
a1d7ed6e ^
20f94973 ^
227f75db ^

fa704bab ^
4f1a6e67 ^
a99d5019 ^



73811372 ^
cb1ed288 ^

bd0ede8d ^

d46a05a8 ^
a1d7ed6e ^

a1d7ed6e ^
0128bee7 ^



f2d8598d ^
0128bee7 ^
f2d8598d ^
0a1bc759 ^
0c0b9489 ^



9506fb8e ^
0128bee7 ^
b4a0c387 ^
20f94973 ^
0c0b9489 ^
0c0b9489 ^


c2238598 ^




a9f69385 ^

16246965 ^



be7c282c ^




a1d7ed6e ^
ad1a4204 ^

b4b0eb24 ^
ad1a4204 ^



b4b0eb24 ^
a1d7ed6e ^
f8e96a97 ^

871c502d ^

361781cd ^







f2d8598d ^

361781cd ^




0cfc59d6 ^
361781cd ^
0cfc59d6 ^
361781cd ^
0cfc59d6 ^
361781cd ^
0cfc59d6 ^
7626fd1d ^
0cfc59d6 ^



9b83f114 ^
0cfc59d6 ^
3937f010 ^


0a16f0da ^
3937f010 ^
f2d8598d ^
361781cd ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156