mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: change cur_line, tmp_line only in main pass
This commit is contained in:

committed by
Alexander Medvednikov

parent
38c58f9f1b
commit
67c2932f34
@@ -50,7 +50,7 @@ fn new_cgen(out_name_c string) *CGen {
|
||||
}
|
||||
|
||||
fn (g mut CGen) genln(s string) {
|
||||
if g.nogen || g.run == .decl {
|
||||
if g.nogen || g.run != .main {
|
||||
return
|
||||
}
|
||||
if g.is_tmp {
|
||||
@@ -66,7 +66,7 @@ fn (g mut CGen) genln(s string) {
|
||||
}
|
||||
|
||||
fn (g mut CGen) gen(s string) {
|
||||
if g.nogen || g.run == .decl {
|
||||
if g.nogen || g.run != .main {
|
||||
return
|
||||
}
|
||||
if g.is_tmp {
|
||||
@@ -77,6 +77,18 @@ fn (g mut CGen) gen(s string) {
|
||||
}
|
||||
}
|
||||
|
||||
fn (g mut CGen) resetln(s string) {
|
||||
if g.nogen || g.run != .main {
|
||||
return
|
||||
}
|
||||
if g.is_tmp {
|
||||
g.tmp_line = s
|
||||
}
|
||||
else {
|
||||
g.cur_line = s
|
||||
}
|
||||
}
|
||||
|
||||
fn (g mut CGen) save() {
|
||||
s := g.lines.join('\n')
|
||||
g.out.writeln(s)
|
||||
@@ -109,7 +121,7 @@ fn (g mut CGen) add_placeholder() int {
|
||||
}
|
||||
|
||||
fn (g mut CGen) set_placeholder(pos int, val string) {
|
||||
if g.nogen {
|
||||
if g.nogen || g.run != .main {
|
||||
return
|
||||
}
|
||||
// g.lines.set(pos, val)
|
||||
@@ -135,7 +147,7 @@ fn (g mut CGen) add_placeholder2() int {
|
||||
}
|
||||
|
||||
fn (g mut CGen) set_placeholder2(pos int, val string) {
|
||||
if g.nogen {
|
||||
if g.nogen || g.run != .main {
|
||||
return
|
||||
}
|
||||
if g.is_tmp {
|
||||
|
Reference in New Issue
Block a user