diff --git a/compiler/main.v b/compiler/main.v index 714adf3866..1b84e54814 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -49,11 +49,6 @@ enum Pass { main } -fn mykek(o OS) { - - -} - struct V { mut: os OS // the OS to build for diff --git a/compiler/parser.v b/compiler/parser.v index c9f3bd667f..e1e15135a3 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -2301,7 +2301,7 @@ fn (p mut Parser) array_init() string { name := p.check_name() if p.table.known_type(name) { p.cgen.cur_line = '' - p.gen('{} /* arkek init*/') + p.gen('{}') return '[$lit]$name' } else { diff --git a/compiler/scanner.v b/compiler/scanner.v index 5e9428c20c..820905710c 100644 --- a/compiler/scanner.v +++ b/compiler/scanner.v @@ -314,8 +314,8 @@ fn (s mut Scanner) scan() ScanRes { case `$`: return scan_res(.dollar, '') case `}`: - // s = `hello $name kek` - // s = `hello ${name} kek` + // s = `hello $name !` + // s = `hello ${name} !` if s.inside_string { s.pos++ // TODO UN.neEDED? diff --git a/compiler/table.v b/compiler/table.v index b4db0c0380..1b7e167aa4 100644 --- a/compiler/table.v +++ b/compiler/table.v @@ -32,7 +32,7 @@ mut: fields []Var methods []Fn parent string - func Fn // For cat == FN (type kek fn()) + func Fn // For cat == FN (type myfn fn()) is_c bool // C.FI.le is_interface bool is_enum bool diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index c465e451ef..f16b32f399 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -6,6 +6,8 @@ module builtin // V strings are not null-terminated. struct string { +mut: + hash_cache int pub: str byteptr len int @@ -797,13 +799,12 @@ pub fn (c byte) is_white() bool { pub fn (s string) hash() int { - mut hash := int(0) - for i := 0; i < s.len; i++ { - // if key == 'Content-Type' { - // println('$i) $hash') - // } - hash = hash * int(31) + int(s.str[i]) - } - return hash + mut h := s.hash_cache + if h == 0 && s.len > 0 { + for c in s { + h = h * 31 + int(c) + } + } + return h } diff --git a/vlib/builtin/string_test.v b/vlib/builtin/string_test.v index d112e0db49..99507d58b7 100644 --- a/vlib/builtin/string_test.v +++ b/vlib/builtin/string_test.v @@ -155,12 +155,12 @@ fn test_replace() { assert b==('hello world') b = b.replace('h', 'H') assert b==('Hello world') - b = b.replace('kek', 'lul') + b = b.replace('foo', 'bar') assert b==('Hello world') s := 'hey man how are you' assert s.replace('man ', '') == 'hey how are you' lol := 'lol lol lol' - assert lol.replace('lol', 'kek') == 'kek kek kek' + assert lol.replace('lol', 'LOL') == 'LOL LOL LOL' b = 'oneBtwoBBthree' assert b.replace('B', '') == 'onetwothree' b = '**char' diff --git a/vlib/gg/gg.v b/vlib/gg/gg.v index 9d1802db35..c07b677715 100644 --- a/vlib/gg/gg.v +++ b/vlib/gg/gg.v @@ -54,7 +54,6 @@ pub fn init() { struct Face { cobj voidptr - kek int } struct Cfg { @@ -368,7 +367,6 @@ pub fn new_context_text(cfg Cfg, scale int) *GG { mut chars := []gg.Character{} f := Face { cobj: 0 - kek: 0 } # f.cobj = &face; // # for (GLubyte c = 0; c < 128; c++)