mirror of
https://github.com/vlang/v.git
synced 2025-09-14 15:02:33 +03:00
fix single file programs without fn main
and REPL (allow imports,
function definitions, consts, etc)
This commit is contained in:
parent
fd9163f715
commit
bd49977feb
5 changed files with 31 additions and 28 deletions
|
@ -210,7 +210,7 @@ fn (table &Table) known_type(typ string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// TODO PERF O(N) this slows down the comiler a lot!
|
||||
// TODO PERF O(N) this slows down the compiler a lot!
|
||||
fn (t &Table) find_fn(name string) Fn {
|
||||
for f in t.fns {
|
||||
if f.name == name {
|
||||
|
@ -220,7 +220,7 @@ fn (t &Table) find_fn(name string) Fn {
|
|||
return Fn{}
|
||||
}
|
||||
|
||||
// TODO PERF O(N) this slows down the comiler a lot!
|
||||
// TODO PERF O(N) this slows down the compiler a lot!
|
||||
fn (t &Table) known_fn(name string) bool {
|
||||
for f in t.fns {
|
||||
if f.name == name {
|
||||
|
@ -249,10 +249,9 @@ fn (t mut Table) register_type(typ string) {
|
|||
// if t.types.filter( _.name == typ.name).len > 0 {
|
||||
// return
|
||||
// }
|
||||
datyp := Type {
|
||||
t.types << Type {
|
||||
name: typ
|
||||
}
|
||||
t.types << datyp
|
||||
}
|
||||
|
||||
fn (p mut Parser) register_type_with_parent(strtyp, parent string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue