1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v2: compile vrepl, 'fn main(){println(2+2)}' runs now

It works if you give it complete V programs like
fn main(){println(2+2)}
but not for single expressions like 2+2 or statements like a:='abc'
This commit is contained in:
Delyan Angelov
2020-04-02 19:21:12 +03:00
committed by GitHub
parent fd12e4e826
commit abf15e863c
2 changed files with 15 additions and 9 deletions

View File

@ -916,6 +916,10 @@ pub fn (s mut []string) sort_by_len() {
s.sort_with_compare(compare_strings_by_len)
}
pub fn (s ustring) str() string {
return s.s
}
pub fn (s string) ustring() ustring {
mut res := ustring{
s: s
@ -985,7 +989,7 @@ fn (u ustring) ge(a ustring) bool {
return !u.lt(a)
}
fn (u ustring) add(a ustring) ustring {
pub fn (u ustring) add(a ustring) ustring {
mut res := ustring{
s: u.s + a.s
runes: new_array(0, u.s.len + a.s.len, sizeof(int))