mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: add UnsafeExpr (#5793)
This commit is contained in:
@ -13,7 +13,7 @@ pub type Expr = AnonFn | ArrayInit | AsCast | Assoc | BoolLiteral | CallExpr | C
|
||||
CharLiteral | ComptimeCall | ConcatExpr | EnumVal | FloatLiteral | Ident | IfExpr | IfGuardExpr |
|
||||
IndexExpr | InfixExpr | IntegerLiteral | Likely | LockExpr | MapInit | MatchExpr | None |
|
||||
OrExpr | ParExpr | PostfixExpr | PrefixExpr | RangeExpr | SelectorExpr | SizeOf | SqlExpr |
|
||||
StringInterLiteral | StringLiteral | StructInit | Type | TypeOf
|
||||
StringInterLiteral | StringLiteral | StructInit | Type | TypeOf | UnsafeExpr
|
||||
|
||||
pub type Stmt = AssertStmt | AssignStmt | Attr | Block | BranchStmt | Comment | CompFor |
|
||||
CompIf | ConstDecl | DeferStmt | EnumDecl | ExprStmt | FnDecl | ForCStmt | ForInStmt |
|
||||
@ -446,6 +446,12 @@ pub mut:
|
||||
left_as_name string // only used in x is SumType check
|
||||
}
|
||||
|
||||
pub struct UnsafeExpr {
|
||||
pub:
|
||||
stmts []Stmt
|
||||
pos token.Position
|
||||
}
|
||||
|
||||
pub struct LockExpr {
|
||||
pub:
|
||||
stmts []Stmt
|
||||
|
@ -254,6 +254,9 @@ pub fn (x Expr) str() string {
|
||||
Likely {
|
||||
return '_likely_(${it.expr.str()})'
|
||||
}
|
||||
UnsafeExpr {
|
||||
return 'unsafe { $it.stmts.len stmts }'
|
||||
}
|
||||
else {
|
||||
return '[unhandled expr type ${typeof(x)}]'
|
||||
}
|
||||
|
Reference in New Issue
Block a user