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: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Install dependencies - 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 - name: Build v
run: make && ./v -o v v.v run: make && ./v -o v v.v
- name: Test v->c with tcc - name: Test v->c with tcc
env: env:
VFLAGS: -cc tcc VFLAGS: -cc tcc
run: | run: |
echo "New TCC"
sudo ln -s /var/tmp/tcc/bin/tcc /usr/local/bin/tcc
tcc -version tcc -version
./v -o v2 v.v # Make sure vtcc can build itself ./v -o v2 v.v # Make sure vtcc can build itself
./v test v ./v test v

View File

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

View File

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