parser: correctly set pos of sql blocks (#9334)

pull/9343/head
Lukas Neubert 2021-03-16 22:00:50 +01:00 committed by GitHub
parent d30750de92
commit 05b51c5b01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -61,3 +61,13 @@ fn prevent_empty_line_after_multi_line_statements() {
println('s')
}
}
fn between_orm_blocks() {
sql db {
insert upper_1 into Upper
}
upper_s := sql db {
select from Upper where id == 1
}
}

View File

@ -100,7 +100,7 @@ fn (mut p Parser) sql_expr() ast.Expr {
order_expr: order_expr
has_desc: has_desc
is_array: !query_one
pos: pos
pos: pos.extend(p.prev_tok.position())
table_expr: ast.Type{
typ: table_type
pos: table_pos
@ -195,7 +195,7 @@ fn (mut p Parser) sql_stmt() ast.SqlStmt {
pos: table_pos
}
object_var_name: inserted_var_name
pos: pos
pos: pos.extend(p.prev_tok.position())
updated_columns: updated_columns
update_exprs: update_exprs
kind: kind