token: apply @[direct_array_access] to TrieNode.add_word

This commit is contained in:
Delyan Angelov 2024-10-14 15:04:06 +03:00
parent 9a88446ee0
commit 5786099cb0
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -125,6 +125,7 @@ pub fn (node &TrieNode) show(level int) {
// add_word adds another `word` and `value` pair into the trie, starting from `node` (recursively).
// `word_idx` is just used as an accumulator, and starts from 0 at the root of the tree.
@[direct_array_access]
pub fn (mut node TrieNode) add_word(word string, value int, word_idx int) {
first := u8(word[word_idx] or {
node.value = value