mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ast, parser: add syms_pos to import ast (#9541)
This commit is contained in:
parent
6daefde5cb
commit
0b39de2fd3
@ -305,6 +305,7 @@ pub:
|
|||||||
pos token.Position
|
pos token.Position
|
||||||
mod_pos token.Position
|
mod_pos token.Position
|
||||||
alias_pos token.Position
|
alias_pos token.Position
|
||||||
|
syms_pos token.Position
|
||||||
pub mut:
|
pub mut:
|
||||||
syms []ImportSymbol // the list of symbols in `import {symbol1, symbol2}`
|
syms []ImportSymbol // the list of symbols in `import {symbol1, symbol2}`
|
||||||
comments []Comment
|
comments []Comment
|
||||||
|
@ -2530,7 +2530,14 @@ fn (mut p Parser) import_stmt() ast.Import {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if p.tok.kind == .lcbr { // import module { fn1, Type2 } syntax
|
if p.tok.kind == .lcbr { // import module { fn1, Type2 } syntax
|
||||||
|
mut initial_syms_pos := p.tok.position()
|
||||||
p.import_syms(mut import_node)
|
p.import_syms(mut import_node)
|
||||||
|
initial_syms_pos = initial_syms_pos.extend(p.tok.position())
|
||||||
|
import_node = ast.Import{
|
||||||
|
...import_node
|
||||||
|
syms_pos: initial_syms_pos
|
||||||
|
pos: import_node.pos.extend(initial_syms_pos)
|
||||||
|
}
|
||||||
p.register_used_import(mod_alias) // no `unused import` msg for parent
|
p.register_used_import(mod_alias) // no `unused import` msg for parent
|
||||||
}
|
}
|
||||||
pos_t := p.tok.position()
|
pos_t := p.tok.position()
|
||||||
|
Loading…
Reference in New Issue
Block a user