mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: small optimizations
This commit is contained in:
@ -320,6 +320,10 @@ fn (table &Table) known_type(typ_ string) bool {
|
||||
return t.name.len > 0 && !t.is_placeholder
|
||||
}
|
||||
|
||||
fn (table &Table) known_type_fast(t &Type) bool {
|
||||
return t.name.len > 0 && !t.is_placeholder
|
||||
}
|
||||
|
||||
fn (t &Table) find_fn(name string) Fn {
|
||||
f := t.fns[name]
|
||||
if !isnil(f.name.str) {
|
||||
@ -345,7 +349,7 @@ fn (t mut Table) register_type(typ string) {
|
||||
}
|
||||
if typ in t.typesmap {
|
||||
return
|
||||
}
|
||||
}
|
||||
t.typesmap[typ] = Type{name:typ}
|
||||
}
|
||||
|
||||
@ -684,6 +688,7 @@ fn (t &Table) main_exists() bool {
|
||||
|
||||
// TODO use `?Var`
|
||||
fn (t &Table) find_const(name string) Var {
|
||||
//println('find const l=$t.consts.len')
|
||||
for c in t.consts {
|
||||
if c.name == name {
|
||||
return c
|
||||
|
Reference in New Issue
Block a user