parent
0ceb16f285
commit
50ab2cfd1a
|
@ -1651,7 +1651,8 @@ pub fn (mut f Fmt) call_expr(node ast.CallExpr) {
|
||||||
// `time.now()` without `time imported` is processed as a method call with `time` being
|
// `time.now()` without `time imported` is processed as a method call with `time` being
|
||||||
// a `node.left` expression. Import `time` automatically.
|
// a `node.left` expression. Import `time` automatically.
|
||||||
// TODO fetch all available modules
|
// TODO fetch all available modules
|
||||||
if node.left.name in ['time', 'os', 'strings', 'math', 'json', 'base64'] {
|
if node.left.name in ['time', 'os', 'strings', 'math', 'json', 'base64']
|
||||||
|
&& !node.left.scope.known_var(node.left.name) {
|
||||||
f.file.imports << ast.Import{
|
f.file.imports << ast.Import{
|
||||||
mod: node.left.name
|
mod: node.left.name
|
||||||
alias: node.left.name
|
alias: node.left.name
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
fn main() {
|
||||||
|
strings := 'hello'
|
||||||
|
a := strings.repeat(2)
|
||||||
|
println(a)
|
||||||
|
}
|
Loading…
Reference in New Issue