parser: start removing start_tmp()

pull/2728/head
Alexander Medvednikov 2019-11-11 05:06:24 +03:00
parent f30d0ce667
commit 00b3557ce1
3 changed files with 9 additions and 12 deletions

View File

@ -47,13 +47,15 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install --quiet -y tcc libglfw3 libglfw3-dev libfreetype6-dev libssl-dev sqlite3 libsqlite3-dev
run: sudo apt-get update; sudo apt-get install --quiet -y libglfw3 libglfw3-dev libfreetype6-dev libssl-dev sqlite3 libsqlite3-dev
- name: Build v
run: make && ./v -o v v.v
- name: Test v->c with tcc
env:
VFLAGS: -cc tcc
run: |
echo "New TCC"
sudo ln -s /var/tmp/tcc/bin/tcc /usr/local/bin/tcc
tcc -version
./v -o v2 v.v # Make sure vtcc can build itself
./v test v

View File

@ -120,10 +120,9 @@ fn (p mut Parser) comp_time() {
p.check(.dollar)
p.check(.name)
p.check(.assign)
p.cgen.start_tmp()
p.bool_expression()
val := p.cgen.end_tmp()
println(val)
_, val := p.tmp_expr()
//p.bool_expression()
//val := p.cgen.end_tmp()
p.check(.rcbr)
// }
}

View File

@ -2153,10 +2153,8 @@ fn (p mut Parser) string_expr() {
complex_inter = true
}
// Get bool expr inside a temp var
p.cgen.start_tmp()
typ := p.bool_expression()
mut val := p.cgen.end_tmp()
val = val.trim_space()
typ, val_ := p.tmp_expr()
val := val_.trim_space()
args += ', $val'
if typ == 'string' {
// args += '.str'
@ -2264,8 +2262,7 @@ fn (p mut Parser) map_init() string {
keys_gen += 'tos3("$key"), '
p.check(.str)
p.check(.colon)
p.cgen.start_tmp()
t := p.bool_expression()
t, val_expr := p.tmp_expr()
if i == 0 {
val_type = t
}
@ -2275,7 +2272,6 @@ fn (p mut Parser) map_init() string {
p.error('bad map element type `$val_type` instead of `$t`')
}
}
val_expr := p.cgen.end_tmp()
vals_gen += '$val_expr, '
if p.tok == .rcbr {
p.check(.rcbr)