examples: fix news_fetcher on Windows

pull/1291/head
Alexander Medvednikov 2019-07-24 02:35:25 +02:00
parent fcb1f211e3
commit 7f29928aec
4 changed files with 18 additions and 12 deletions

View File

@ -1,3 +1,9 @@
## V 0.1.17
- @ for escaping keywords (e.g. `struct Foo { @type string }`).
- Windows Unicode fixes (V can now work with non-ASCII paths etc on Windows).
## V 0.1.16 ## V 0.1.16
*23 Jul 2019* *23 Jul 2019*
- V can now be used with Visual Studio! - V can now be used with Visual Studio!

View File

@ -401,7 +401,7 @@ _thread_so = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&reload_so, 0, 0, 0);
cgen_name := p.table.cgen_name(f) cgen_name := p.table.cgen_name(f)
f.defer_text = ' ${cgen_name}_time += time__ticks() - _PROF_START;' f.defer_text = ' ${cgen_name}_time += time__ticks() - _PROF_START;'
} }
p.statements_no_curly_end() p.statements_no_rcbr()
// Print counting result after all statements in main // Print counting result after all statements in main
if p.pref.is_prof && f.name == 'main' { if p.pref.is_prof && f.name == 'main' {
p.genln(p.print_prof_counters()) p.genln(p.print_prof_counters())

View File

@ -962,17 +962,17 @@ fn (p &Parser) print_tok() {
// statements() returns the type of the last statement // statements() returns the type of the last statement
fn (p mut Parser) statements() string { fn (p mut Parser) statements() string {
p.log('statements()') p.log('statements()')
typ := p.statements_no_curly_end() typ := p.statements_no_rcbr()
if !p.inside_if_expr { if !p.inside_if_expr {
p.genln('}') p.genln('}')
} }
if p.fileis('if_expr') { //if p.fileis('if_expr') {
println('statements() ret=$typ line=$p.scanner.line_nr') //println('statements() ret=$typ line=$p.scanner.line_nr')
} //}
return typ return typ
} }
fn (p mut Parser) statements_no_curly_end() string { fn (p mut Parser) statements_no_rcbr() string {
p.cur_fn.open_scope() p.cur_fn.open_scope()
if !p.inside_if_expr { if !p.inside_if_expr {
p.genln('') p.genln('')
@ -2819,7 +2819,7 @@ fn (p mut Parser) comp_time() {
p.genln('#ifdef $ifdef_name') p.genln('#ifdef $ifdef_name')
} }
p.check(.lcbr) p.check(.lcbr)
p.statements_no_curly_end() p.statements_no_rcbr()
if ! (p.tok == .dollar && p.peek() == .key_else) { if ! (p.tok == .dollar && p.peek() == .key_else) {
p.genln('#endif') p.genln('#endif')
} }
@ -2859,7 +2859,7 @@ fn (p mut Parser) comp_time() {
p.next() p.next()
p.check(.lcbr) p.check(.lcbr)
p.genln('#else') p.genln('#else')
p.statements_no_curly_end() p.statements_no_rcbr()
p.genln('#endif') p.genln('#endif')
} }
else { else {

View File

@ -7,11 +7,11 @@ module sync
struct Mutex { struct Mutex {
} }
fn (m Mutex) lock() { pub fn (m Mutex) lock() {
panic('not implemented') //panic('not implemented')
} }
fn (m Mutex) unlock() { pub fn (m Mutex) unlock() {
panic('not implemented') //panic('not implemented')
} }