ast/checker: cast no longer needed & use auto deref
parent
8488f7d82b
commit
2a40665919
|
@ -60,8 +60,7 @@ pub fn (s &Scope) is_known(name string) bool {
|
||||||
|
|
||||||
pub fn (s &Scope) find_var(name string) ?&Var {
|
pub fn (s &Scope) find_var(name string) ?&Var {
|
||||||
if obj := s.find(name) {
|
if obj := s.find(name) {
|
||||||
v := ScopeObject(obj)
|
match obj {
|
||||||
match v {
|
|
||||||
Var {
|
Var {
|
||||||
return it
|
return it
|
||||||
}
|
}
|
||||||
|
@ -73,8 +72,7 @@ pub fn (s &Scope) find_var(name string) ?&Var {
|
||||||
|
|
||||||
pub fn (s &Scope) find_const(name string) ?&ConstField {
|
pub fn (s &Scope) find_const(name string) ?&ConstField {
|
||||||
if obj := s.find(name) {
|
if obj := s.find(name) {
|
||||||
cf := ScopeObject(obj)
|
match obj {
|
||||||
match cf {
|
|
||||||
ConstField {
|
ConstField {
|
||||||
return it
|
return it
|
||||||
}
|
}
|
||||||
|
|
|
@ -1331,7 +1331,7 @@ fn const_int_value(cfield ast.ConstField) ?int {
|
||||||
|
|
||||||
fn is_const_integer(cfield ast.ConstField) ?ast.IntegerLiteral {
|
fn is_const_integer(cfield ast.ConstField) ?ast.IntegerLiteral {
|
||||||
match cfield.expr {
|
match cfield.expr {
|
||||||
ast.IntegerLiteral { return *it }
|
ast.IntegerLiteral { return it }
|
||||||
else {}
|
else {}
|
||||||
}
|
}
|
||||||
return none
|
return none
|
||||||
|
|
Loading…
Reference in New Issue