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

fix strings.Builder.str()

This commit is contained in:
Alexander Medvednikov 2019-11-17 02:22:43 +03:00
parent be7cf3e812
commit 6ae8457f35
4 changed files with 7 additions and 8 deletions

View File

@ -19,8 +19,8 @@ jobs:
run: ./v -o v2 v.v && ./v2 -o v3 v.v run: ./v -o v2 v.v && ./v2 -o v3 v.v
- name: Test v->c - name: Test v->c
run: ./v test v run: ./v test v
- name: Test v->js # - name: Test v->js
run: ./v -o hi.js examples/hello_v_js.v && node hi.js # run: ./v -o hi.js examples/hello_v_js.v && node hi.js
- name: Test vid - name: Test vid
run: | run: |
git clone --depth 1 https://github.com/vlang/vid.git git clone --depth 1 https://github.com/vlang/vid.git

View File

@ -1,6 +1,4 @@
fn test_inline_asm() { fn test_inline_asm() {
$if !windows {
$if !tinyc {
a := 10 a := 10
b := 0 b := 0
unsafe { unsafe {
@ -18,11 +16,11 @@ fn test_inline_asm() {
e := 0 e := 0
unsafe { unsafe {
asm( asm(
//".intel_syntax noprefix;"
//"mov %0, 5"
"movl $5, %0" "movl $5, %0"
:"=a"(e) :"=a"(e)
) )
} }
assert e == 5 assert e == 5
}
}
} }

View File

@ -86,6 +86,6 @@ fn (w &Writer) field_needs_quotes(field string) bool {
return false return false
} }
pub fn (w &Writer) str() string { pub fn (w mut Writer) str() string {
return w.sb.str() return w.sb.str()
} }

View File

@ -36,7 +36,8 @@ pub fn (b mut Builder) writeln(s string) {
b.len += s.len + 1 b.len += s.len + 1
} }
pub fn (b Builder) str() string { pub fn (b mut Builder) str() string {
b.buf << `\0`
return string(b.buf, b.len) return string(b.buf, b.len)
} }