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

View File

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

View File

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