mirror of
https://github.com/vlang/v.git
synced 2025-09-14 06:52:36 +03:00
parser: small optimizations
This commit is contained in:
parent
794cd561cd
commit
76a89c832e
3 changed files with 15 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue