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

ast: TypeOf

This commit is contained in:
Alexander Medvednikov
2020-03-19 12:15:39 +01:00
parent 79077b0025
commit b290efa394
6 changed files with 30 additions and 8 deletions

View File

@@ -765,6 +765,15 @@ pub fn (p mut Parser) expr(precedence int) ast.Expr {
}
}
.key_typeof {
p.next()
p.check(.lpar)
expr := p.expr(0)
p.check(.rpar)
node = ast.TypeOf{
expr: expr
}
}
// Map `{"age": 20}` or `{ x | foo:bar, a:10 }`
.lcbr {
p.next()