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

all: new function isreftype(T) to know if T contains pointers (#10438)

This commit is contained in:
Uwe Krüger
2021-06-13 05:26:13 +02:00
committed by GitHub
parent 4a59316600
commit 2ac39d9112
10 changed files with 147 additions and 20 deletions

View File

@ -979,6 +979,9 @@ fn (t Tree) expr(expr ast.Expr) &Node {
ast.SizeOf {
return t.size_of(expr)
}
ast.IsRefType {
return t.is_ref_type(expr)
}
ast.PrefixExpr {
return t.prefix_expr(expr)
}
@ -1225,6 +1228,16 @@ fn (t Tree) size_of(node ast.SizeOf) &Node {
return obj
}
fn (t Tree) is_ref_type(node ast.IsRefType) &Node {
mut obj := new_object()
obj.add('ast_type', t.string_node('IsRefType'))
obj.add('is_type', t.bool_node(node.is_type))
obj.add('typ', t.type_node(node.typ))
obj.add('expr', t.expr(node.expr))
obj.add('pos', t.position(node.pos))
return obj
}
fn (t Tree) prefix_expr(node ast.PrefixExpr) &Node {
mut obj := new_object()
obj.add('ast_type', t.string_node('PrefixExpr'))