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

rename table.register_type2()

This commit is contained in:
Alexander Medvednikov 2019-12-05 14:09:33 +03:00
parent 0ff2754677
commit 2a1b0a8cae
7 changed files with 15 additions and 15 deletions

View File

@ -57,7 +57,7 @@ fn (p mut Parser) enum_decl(no_name bool) {
} }
val++ val++
} }
p.table.register_type2(Type { p.table.register_type(Type {
name: enum_name name: enum_name
mod: p.mod mod: p.mod
parent: 'int' parent: 'int'

View File

@ -328,7 +328,7 @@ fn (p mut Parser) name_expr() string {
mod: p.mod mod: p.mod
func: f func: f
} }
p.table.register_type2(fn_typ) p.table.register_type(fn_typ)
p.gen(p.table.fn_gen_name(f)) p.gen(p.table.fn_gen_name(f))
p.next() p.next()
return f.typ_str() //'void*' return f.typ_str() //'void*'

View File

@ -473,7 +473,7 @@ fn (p mut Parser) fn_decl() {
mod: p.mod mod: p.mod
is_placeholder: true is_placeholder: true
} }
p.table.register_type2(receiver_t) p.table.register_type(receiver_t)
} }
p.add_method(receiver_t.name, f) p.add_method(receiver_t.name, f)
} }
@ -1346,7 +1346,7 @@ fn (p mut Parser) register_vargs_stuct(typ string, len int) string {
} }
mut varg_len := len mut varg_len := len
if !p.table.known_type(vargs_struct) { if !p.table.known_type(vargs_struct) {
p.table.register_type2(varg_type) p.table.register_type(varg_type)
p.cgen.typedefs << 'typedef struct $vargs_struct $vargs_struct;\n' p.cgen.typedefs << 'typedef struct $vargs_struct $vargs_struct;\n'
} else { } else {
ex_typ := p.table.find_type(vargs_struct) ex_typ := p.table.find_type(vargs_struct)
@ -1418,7 +1418,7 @@ fn (p mut Parser) fn_gen_caller_vargs(f &Fn, varg_type string, values []string)
fn (p mut Parser) register_multi_return_stuct(types []string) string { fn (p mut Parser) register_multi_return_stuct(types []string) string {
typ := '_V_MulRet_' + types.join('_V_').replace('*', '_PTR_') typ := '_V_MulRet_' + types.join('_V_').replace('*', '_PTR_')
if p.table.known_type(typ) { return typ } if p.table.known_type(typ) { return typ }
p.table.register_type2(Type{ p.table.register_type(Type{
cat: .struct_, cat: .struct_,
name: typ, name: typ,
mod: p.mod mod: p.mod

View File

@ -752,7 +752,7 @@ fn (p mut Parser) type_decl() {
'' ''
} }
p.gen_typedef('typedef $_struct $nt_pair; //type alias name="$name" parent=`$parent.name`') p.gen_typedef('typedef $_struct $nt_pair; //type alias name="$name" parent=`$parent.name`')
p.table.register_type2(Type{ p.table.register_type(Type{
name: name name: name
parent: parent.name parent: parent.name
mod: p.mod mod: p.mod
@ -931,7 +931,7 @@ fn (p mut Parser) get_type() string {
mod: p.mod mod: p.mod
func: f func: f
} }
p.table.register_type2(fn_typ) p.table.register_type(fn_typ)
return f.typ_str() return f.typ_str()
} }
// arrays ([]int) // arrays ([]int)

View File

@ -33,7 +33,7 @@ fn (p mut Parser) get_type2() Type {
func: f func: f
cat: .func cat: .func
} }
p.table.register_type2(fn_typ) p.table.register_type(fn_typ)
return fn_typ return fn_typ
} }
// arrays ([]int) // arrays ([]int)

View File

@ -103,7 +103,7 @@ fn (p mut Parser) struct_decl() {
} }
// Struct `C.Foo` declaration, no body // Struct `C.Foo` declaration, no body
if is_c && is_struct && p.tok != .lcbr { if is_c && is_struct && p.tok != .lcbr {
p.table.register_type2(typ) p.table.register_type(typ)
return return
} }
p.fspace() p.fspace()
@ -126,7 +126,7 @@ fn (p mut Parser) struct_decl() {
if !is_ph && p.first_pass() { if !is_ph && p.first_pass() {
p.table.register_type2(typ) p.table.register_type(typ)
//println('registering 1 nrfields=$typ.fields.len') //println('registering 1 nrfields=$typ.fields.len')
} }

View File

@ -106,7 +106,7 @@ mut:
enum_vals []string enum_vals []string
gen_types []string gen_types []string
default_vals []string // `struct Foo { bar int = 2 }` default_vals []string // `struct Foo { bar int = 2 }`
// This field is used for types that are not defined yet but are known to exist. // `is_placeholder` is used for types that are not defined yet but are known to exist.
// It allows having things like `fn (f Foo) bar()` before `Foo` is defined. // It allows having things like `fn (f Foo) bar()` before `Foo` is defined.
// This information is needed in the first pass. // This information is needed in the first pass.
is_placeholder bool is_placeholder bool
@ -397,7 +397,7 @@ fn (p mut Parser) register_type_with_parent(strtyp, parent string) {
mod: p.mod mod: p.mod
is_public: true is_public: true
} }
p.table.register_type2(typ) p.table.register_type(typ)
} }
fn (t mut Table) register_type_with_parent(typ, parent string) { fn (t mut Table) register_type_with_parent(typ, parent string) {
@ -412,7 +412,7 @@ fn (t mut Table) register_type_with_parent(typ, parent string) {
} }
} }
fn (t mut Table) register_type2(typ Type) { fn (t mut Table) register_type(typ Type) {
if typ.name.len == 0 { if typ.name.len == 0 {
return return
} }