Skip to content

Commit d9e92a0

Browse files
v2: use pointer to table.type, fix unresolved array/map sub-types
1 parent 6c36134 commit d9e92a0

File tree

13 files changed

+494
-491
lines changed

13 files changed

+494
-491
lines changed

vlib/v/ast/ast.v

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ HashStmt
2020
pub struct ExprStmt {
2121
pub:
2222
expr Expr
23-
ti table.Type
23+
typ table.TypeRef
2424
}
2525

2626
pub struct IntegerLiteral {
@@ -69,7 +69,7 @@ pub struct Field {
6969
pub:
7070
name string
7171
// type_idx int
72-
typ table.Type
72+
typ table.TypeRef
7373
}
7474

7575
pub struct ConstDecl {
@@ -89,7 +89,7 @@ pub:
8989
pub struct StructInit {
9090
pub:
9191
pos token.Position
92-
ti table.Type
92+
typ table.TypeRef
9393
fields []string
9494
exprs []Expr
9595
}
@@ -105,15 +105,15 @@ pub:
105105

106106
pub struct Arg {
107107
pub:
108-
ti table.Type
108+
typ table.TypeRef
109109
name string
110110
}
111111

112112
pub struct FnDecl {
113113
pub:
114114
name string
115115
stmts []Stmt
116-
ti table.Type
116+
typ table.TypeRef
117117
args []Arg
118118
is_pub bool
119119
receiver Field
@@ -145,9 +145,9 @@ pub:
145145

146146
pub struct Return {
147147
pub:
148-
pos token.Position
149-
expected_ti table.Type // TODO: remove once checker updated
150-
exprs []Expr
148+
pos token.Position
149+
expected_type table.TypeRef // TODO: remove once checker updated
150+
exprs []Expr
151151
}
152152

153153
/*
@@ -172,7 +172,7 @@ pub:
172172
expr Expr
173173
is_mut bool
174174
mut:
175-
typ table.Type
175+
typ table.TypeRef
176176
pos token.Position
177177
}
178178

@@ -181,7 +181,7 @@ pub:
181181
name string
182182
expr Expr
183183
mut:
184-
typ table.Type
184+
typ table.TypeRef
185185
}
186186

187187
pub struct File {
@@ -194,9 +194,9 @@ pub:
194194
}
195195

196196
pub struct IdentVar {
197-
pub:
198-
typ table.Type
199-
// name string
197+
pub mut:
198+
typ table.TypeRef
199+
//name string
200200
}
201201

202202
type IdentInfo = IdentVar
@@ -225,9 +225,9 @@ pub:
225225
op token.Kind
226226
pos token.Position
227227
left Expr
228-
left_type table.Type
228+
left_type table.TypeRef
229229
right Expr
230-
right_type table.Type
230+
right_type table.TypeRef
231231
}
232232

233233
/*
@@ -241,7 +241,6 @@ pub:
241241
}
242242
*/
243243

244-
245244
pub struct PostfixExpr {
246245
pub:
247246
op token.Kind
@@ -270,7 +269,7 @@ pub:
270269
cond Expr
271270
stmts []Stmt
272271
else_stmts []Stmt
273-
ti table.Type
272+
typ table.TypeRef
274273
left Expr // `a` in `a := if ...`
275274
pos token.Position
276275
}
@@ -354,7 +353,8 @@ pub struct ArrayInit {
354353
pub:
355354
pos token.Position
356355
exprs []Expr
357-
ti table.Type
356+
mut:
357+
typ table.TypeRef
358358
}
359359

360360
// s[10..20]

0 commit comments

Comments
 (0)