fix fmt2 test

pull/4179/head
Alexander Medvednikov 2020-04-01 17:52:50 +02:00
parent e3713de41d
commit 3ef6436bef
3 changed files with 11 additions and 14 deletions

View File

@ -788,12 +788,6 @@ pub fn (c mut Checker) expr(node ast.Expr) table.Type {
it.expr_type = c.expr(it.expr)
return table.string_type
}
/*
ast.UnaryExpr {
c.expr(it.left)
}
*/
else {}
// println('checker.expr(): unhandled node')
// TODO: find nil string bug triggered with typeof

View File

@ -8,6 +8,8 @@ fn main() {
c := 'a: $a b: $b i: $i'
d := 'a: ${a:5s} b: ${b:-5s} i: ${i:20d}'
println('a: $a $b xxx')
eprintln('c: $c')
// QTODO
//eprintln('c: $c')
eprintln('c: $c .')
println(d)
}

View File

@ -52,7 +52,7 @@ pub fn parse_stmt(text string, table &table.Table, scope &ast.Scope) ast.Stmt {
pref: &pref.Preferences{}
scope: scope
// scope: &ast.Scope{start_pos: 0, parent: 0}
}
p.init_parse_fns()
p.read_first_token()
@ -71,13 +71,13 @@ pub fn parse_file(path string, table &table.Table, comments_mode scanner.Comment
table: table
file_name: path
pref: pref // &pref.Preferences{}
scope: &ast.Scope{
start_pos: 0
parent: 0
}
// comments_mode: comments_mode
}
p.read_first_token()
// p.scope = &ast.Scope{start_pos: p.tok.position(), parent: 0}
@ -604,6 +604,7 @@ pub fn (p mut Parser) name_expr() ast.Expr {
}
// Raw string (`s := r'hello \n ')
if p.tok.lit in ['r', 'c'] && p.peek_tok.kind == .string {
// QTODO
// && p.prev_tok.kind != .str_dollar {
return p.string_expr()
}
@ -691,7 +692,7 @@ pub fn (p mut Parser) name_expr() ast.Expr {
p.expr_mod = ''
return ast.EnumVal{
enum_name: enum_name // lp.prepend_mod(enum_name)
val: val
pos: p.tok.position()
mod: mod
@ -781,7 +782,7 @@ pub fn (p mut Parser) expr(precedence int) ast.Expr {
node = ast.SizeOf{
typ: sizeof_type
// type_name: type_name
}
}
.key_typeof {
@ -1052,7 +1053,7 @@ fn (p mut Parser) infix_expr(left ast.Expr) ast.Expr {
left: left
right: right
// right_type: typ
op: op
pos: pos
}
@ -1457,7 +1458,7 @@ fn (p mut Parser) const_decl() ast.ConstDecl {
fields << ast.Field{
name: name
// typ: typ
}
exprs << expr
// TODO: once consts are fixed reg here & update in checker