1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

token: rename Position to Pos, rename position() to pos() (#13279)

This commit is contained in:
yuyi
2022-01-26 18:36:28 +08:00
committed by GitHub
parent d71fc0d13f
commit 291a1ffd8d
61 changed files with 958 additions and 962 deletions

View File

@@ -82,7 +82,7 @@ pub fn (mut c Checker) struct_decl(mut node ast.StructDecl) {
}
} else {
c.error('incompatible initializer for field `$field.name`: $err.msg',
field.default_expr.position())
field.default_expr.pos())
}
}
// Check for unnecessary inits like ` = 0` and ` = ''`
@@ -394,7 +394,7 @@ pub fn (mut c Checker) struct_init(mut node ast.StructInit) ast.Type {
node.update_expr_type = update_type
if c.table.type_kind(update_type) != .struct_ {
s := c.table.type_to_str(update_type)
c.error('expected struct, found `$s`', node.update_expr.position())
c.error('expected struct, found `$s`', node.update_expr.pos())
} else if update_type != node.typ {
from_sym := c.table.sym(update_type)
to_sym := c.table.sym(node.typ)
@@ -403,13 +403,13 @@ pub fn (mut c Checker) struct_init(mut node ast.StructInit) ast.Type {
// TODO this check is too strict
if !c.check_struct_signature(from_info, to_info) {
c.error('struct `$from_sym.name` is not compatible with struct `$to_sym.name`',
node.update_expr.position())
node.update_expr.pos())
}
}
if !node.update_expr.is_lvalue() {
// cgen will repeat `update_expr` for each field
// so enforce an lvalue for efficiency
c.error('expression is not an lvalue', node.update_expr.position())
c.error('expression is not an lvalue', node.update_expr.pos())
}
}
return node.typ