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

ast/checker: cast no longer needed & use auto deref

This commit is contained in:
joe-conigliaro 2020-05-11 20:02:28 +10:00
parent 8488f7d82b
commit 2a40665919
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1
2 changed files with 3 additions and 5 deletions

View File

@ -60,8 +60,7 @@ pub fn (s &Scope) is_known(name string) bool {
pub fn (s &Scope) find_var(name string) ?&Var {
if obj := s.find(name) {
v := ScopeObject(obj)
match v {
match obj {
Var {
return it
}
@ -73,8 +72,7 @@ pub fn (s &Scope) find_var(name string) ?&Var {
pub fn (s &Scope) find_const(name string) ?&ConstField {
if obj := s.find(name) {
cf := ScopeObject(obj)
match cf {
match obj {
ConstField {
return it
}

View File

@ -1331,7 +1331,7 @@ fn const_int_value(cfield ast.ConstField) ?int {
fn is_const_integer(cfield ast.ConstField) ?ast.IntegerLiteral {
match cfield.expr {
ast.IntegerLiteral { return *it }
ast.IntegerLiteral { return it }
else {}
}
return none