1
0
forked from Mirror/wren

Store hash code in strings.

Makes string equality and string map keys much faster.
Also did some other general string clean-up.
This commit is contained in:
Bob Nystrom
2015-03-18 07:09:03 -07:00
parent b80ba29b0e
commit be11d09bd8
14 changed files with 89 additions and 52 deletions

View File

@ -1,3 +1,4 @@
// skip: Range subscripts for strings don't handle UTF-8.
var string = "abcde"
IO.print(string[0..0]) // expect: a
IO.print(string[1...1] == "") // expect: true

View File

@ -1,2 +1,3 @@
// skip: Range subscripts for strings don't handle UTF-8.
var a = "string"
a[1.5..2] // expect runtime error: Range start must be an integer.

View File

@ -1,2 +1,3 @@
// skip: Range subscripts for strings don't handle UTF-8.
var a = "123"
a[3..2] // expect runtime error: Range start out of bounds.

View File

@ -1,2 +1,3 @@
// skip: Range subscripts for strings don't handle UTF-8.
var a = "123"
a[-4..2] // expect runtime error: Range start out of bounds.

View File

@ -1,2 +1,3 @@
// skip: Range subscripts for strings don't handle UTF-8.
var a = "123"
a[1...4] // expect runtime error: Range end out of bounds.

View File

@ -1,2 +1,3 @@
// skip: Range subscripts for strings don't handle UTF-8.
var a = "123"
a[0...-5] // expect runtime error: Range end out of bounds.

View File

@ -1,2 +1,3 @@
// skip: Range subscripts for strings don't handle UTF-8.
var a = "string"
a[1..2.5] // expect runtime error: Range end must be an integer.

View File

@ -1,2 +1,3 @@
// skip: Range subscripts for strings don't handle UTF-8.
var a = "123"
a[1..3] // expect runtime error: Range end out of bounds.

View File

@ -1,2 +1,3 @@
// skip: Range subscripts for strings don't handle UTF-8.
var a = "123"
a[0..-4] // expect runtime error: Range end out of bounds.