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

v.eval: support unsafe expr (#16224)

This commit is contained in:
StunxFS 2022-10-27 03:38:57 -04:00 committed by GitHub
parent ce2c732db8
commit e6fad82b87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -526,12 +526,15 @@ pub fn (mut e Eval) expr(expr ast.Expr, expecting ast.Type) Object {
return res
}
ast.UnsafeExpr {
return e.expr(expr.expr, expecting)
}
ast.AnonFn, ast.ArrayDecompose, ast.AsCast, ast.Assoc, ast.AtExpr, ast.CTempVar,
ast.ChanInit, ast.Comment, ast.ComptimeCall, ast.ComptimeSelector, ast.ComptimeType,
ast.ConcatExpr, ast.DumpExpr, ast.EmptyExpr, ast.EnumVal, ast.GoExpr, ast.IfGuardExpr,
ast.IndexExpr, ast.IsRefType, ast.Likely, ast.LockExpr, ast.MapInit, ast.MatchExpr,
ast.Nil, ast.NodeError, ast.None, ast.OffsetOf, ast.OrExpr, ast.RangeExpr, ast.SelectExpr,
ast.SqlExpr, ast.TypeNode, ast.TypeOf, ast.UnsafeExpr {
ast.SqlExpr, ast.TypeNode, ast.TypeOf {
e.error('unhandled expression ${typeof(expr).name}')
}
}

1
vlib/v/eval/testdata/unsafe_expr.out vendored Normal file
View File

@ -0,0 +1 @@
true

3
vlib/v/eval/testdata/unsafe_expr.vv vendored Normal file
View File

@ -0,0 +1,3 @@
unsafe {
println(true)
}