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

ast: remove redundant import v.ast

This commit is contained in:
Delyan Angelov 2021-04-02 08:31:29 +03:00
parent 5ac9e39d44
commit 69ba93f954
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
3 changed files with 6 additions and 11 deletions

View File

@ -1,7 +1,5 @@
module ast
import v.ast
pub fn resolve_init(node StructInit, typ Type, t &Table) Expr {
type_sym := t.get_type_symbol(typ)
if type_sym.kind == .array {
@ -32,7 +30,7 @@ pub fn resolve_init(node StructInit, typ Type, t &Table) Expr {
}
}
}
return ast.ArrayInit{
return ArrayInit{
// TODO: mod is not being set for now, we could need this in future
// mod: mod
pos: node.pos
@ -51,12 +49,12 @@ pub fn resolve_init(node StructInit, typ Type, t &Table) Expr {
mut keys := []Expr{}
mut vals := []Expr{}
for field in node.fields {
keys << ast.StringLiteral{
keys << StringLiteral{
val: field.name
}
vals << field.expr
}
return ast.MapInit{
return MapInit{
typ: typ
key_type: map_info.key_type
value_type: map_info.value_type
@ -65,7 +63,7 @@ pub fn resolve_init(node StructInit, typ Type, t &Table) Expr {
}
}
// struct / other (sumtype?)
return ast.StructInit{
return StructInit{
...node
unresolved: false
}

View File

@ -3,8 +3,6 @@
// that can be found in the LICENSE file.
module ast
import v.ast
pub struct Scope {
pub mut:
// mut:
@ -18,7 +16,7 @@ pub mut:
}
pub fn new_scope(parent &Scope, start_pos int) &Scope {
return &ast.Scope{
return &Scope{
parent: parent
start_pos: start_pos
}

View File

@ -3,7 +3,6 @@
// that can be found in the LICENSE file.
module ast
import v.ast
import v.util
import strings
@ -117,7 +116,7 @@ pub fn (node &FnDecl) stringify(t &Table, cur_mod string, m2a map[string]string)
}
}
f.write_string(')')
if node.return_type != ast.void_type {
if node.return_type != void_type {
mut rs := util.no_cur_mod(t.type_to_str(node.return_type), cur_mod)
for mod, alias in m2a {
rs = rs.replace(mod, alias)