From 0ad0a61db241dc9df190d3db6e35e39ecd64a274 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Mon, 11 Nov 2019 06:02:01 +0300 Subject: [PATCH] remove unnecessary empty lines in cgen --- vlib/compiler/cgen.v | 4 ++-- vlib/compiler/fn.v | 2 +- vlib/compiler/for.v | 2 +- vlib/compiler/parser.v | 7 +------ 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/vlib/compiler/cgen.v b/vlib/compiler/cgen.v index e9afb1d09f..daccde09f8 100644 --- a/vlib/compiler/cgen.v +++ b/vlib/compiler/cgen.v @@ -106,7 +106,7 @@ fn (g mut CGen) save() { } -// returns expression's type, and entire expression's string representation) +// returns expression's type, and entire expression's string representation fn (p mut Parser) tmp_expr() (string, string) { // former start_tmp() if p.cgen.is_tmp { @@ -117,7 +117,7 @@ fn (p mut Parser) tmp_expr() (string, string) { p.cgen.is_tmp = true // typ := p.bool_expression() - + // former end_tmp() res := p.cgen.tmp_line if p.cgen.prev_tmps.len > 0 { p.cgen.tmp_line = p.cgen.prev_tmps.last() diff --git a/vlib/compiler/fn.v b/vlib/compiler/fn.v index 672b7b4431..5d35bedc20 100644 --- a/vlib/compiler/fn.v +++ b/vlib/compiler/fn.v @@ -1114,10 +1114,10 @@ fn (p mut Parser) fn_call_args(f mut Fn) { p.gen('}[0] ') } else if exp_ptr && expected == got + '*' { + $if !tinyc { expr := p.cgen.cur_line[ph..] // TODO hack // If current expression is a func call, generate the array hack - $if !tinyc { if expr.contains('(') { //println('fn hack expr=$expr') p.cgen.set_placeholder(ph, '& /*113 e="$expected" g="$got"*/ ($got[]){') diff --git a/vlib/compiler/for.v b/vlib/compiler/for.v index 8620b79eac..ea773d3461 100644 --- a/vlib/compiler/for.v +++ b/vlib/compiler/for.v @@ -184,7 +184,7 @@ fn (p mut Parser) for_st() { } p.fspace() p.check(.lcbr) - p.genln('') + //p.genln('') p.statements() p.close_scope() p.for_expr_cnt-- diff --git a/vlib/compiler/parser.v b/vlib/compiler/parser.v index 831d09de17..5829f0f701 100644 --- a/vlib/compiler/parser.v +++ b/vlib/compiler/parser.v @@ -989,10 +989,6 @@ fn (p mut Parser) statements() string { fn (p mut Parser) statements_no_rcbr() string { p.open_scope() - - if !p.inside_if_expr { - p.genln('') - } mut i := 0 mut last_st_typ := '' for p.tok != .rcbr && p.tok != .eof { @@ -1000,7 +996,6 @@ fn (p mut Parser) statements_no_rcbr() string { last_st_typ = p.statement(true) // println('last st typ=$last_st_typ') if !p.inside_if_expr { - p.genln('')// // end st tok= ${p.strtok()}') p.fgenln('') } i++ @@ -2518,7 +2513,7 @@ fn (p mut Parser) if_st(is_expr bool, elif_depth int) string { p.returns = false if p.tok == .key_else { if !p.inside_if_expr { - p.fgenln('') + //p.fgenln('') } p.check(.key_else) p.fspace()