Skip to content

Commit

Permalink
Implement string.length for Kal
Browse files Browse the repository at this point in the history
  • Loading branch information
voltrevo committed Jul 6, 2023
1 parent 5a6d11c commit 385d633
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions valuescript_compiler/src/optimization/kal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ impl FnState {
}
None => Kal::Undefined,
},
Kal::String(key) => match key.as_str() {
"length" => Kal::Number(Number(string.len() as f64)),
_ => Kal::Unknown,
},
_ => Kal::Unknown,
},
Kal::Array(array) => match key {
Expand Down

0 comments on commit 385d633

Please sign in to comment.