rename table.register_type2()
parent
0ff2754677
commit
2a1b0a8cae
|
@ -8,7 +8,7 @@ fn (p mut Parser) enum_decl(no_name bool) {
|
|||
is_pub := p.tok == .key_pub
|
||||
if is_pub {
|
||||
p.next()
|
||||
}
|
||||
}
|
||||
p.check(.key_enum)
|
||||
p.fspace()
|
||||
mut enum_name := p.check_name()
|
||||
|
@ -47,7 +47,7 @@ fn (p mut Parser) enum_decl(no_name bool) {
|
|||
p.next()
|
||||
enum_assign_tidx = p.cur_tok_index()
|
||||
p.error_with_token_index('only numbers are allowed in enum initializations', enum_assign_tidx)
|
||||
}
|
||||
}
|
||||
}
|
||||
if p.pass == .main {
|
||||
p.cgen.consts << '#define $name $val'
|
||||
|
@ -57,7 +57,7 @@ fn (p mut Parser) enum_decl(no_name bool) {
|
|||
}
|
||||
val++
|
||||
}
|
||||
p.table.register_type2(Type {
|
||||
p.table.register_type(Type {
|
||||
name: enum_name
|
||||
mod: p.mod
|
||||
parent: 'int'
|
||||
|
|
|
@ -328,7 +328,7 @@ fn (p mut Parser) name_expr() string {
|
|||
mod: p.mod
|
||||
func: f
|
||||
}
|
||||
p.table.register_type2(fn_typ)
|
||||
p.table.register_type(fn_typ)
|
||||
p.gen(p.table.fn_gen_name(f))
|
||||
p.next()
|
||||
return f.typ_str() //'void*'
|
||||
|
|
|
@ -473,7 +473,7 @@ fn (p mut Parser) fn_decl() {
|
|||
mod: p.mod
|
||||
is_placeholder: true
|
||||
}
|
||||
p.table.register_type2(receiver_t)
|
||||
p.table.register_type(receiver_t)
|
||||
}
|
||||
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
|
||||
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'
|
||||
} else {
|
||||
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 {
|
||||
typ := '_V_MulRet_' + types.join('_V_').replace('*', '_PTR_')
|
||||
if p.table.known_type(typ) { return typ }
|
||||
p.table.register_type2(Type{
|
||||
p.table.register_type(Type{
|
||||
cat: .struct_,
|
||||
name: typ,
|
||||
mod: p.mod
|
||||
|
|
|
@ -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.table.register_type2(Type{
|
||||
p.table.register_type(Type{
|
||||
name: name
|
||||
parent: parent.name
|
||||
mod: p.mod
|
||||
|
@ -931,7 +931,7 @@ fn (p mut Parser) get_type() string {
|
|||
mod: p.mod
|
||||
func: f
|
||||
}
|
||||
p.table.register_type2(fn_typ)
|
||||
p.table.register_type(fn_typ)
|
||||
return f.typ_str()
|
||||
}
|
||||
// arrays ([]int)
|
||||
|
|
|
@ -33,7 +33,7 @@ fn (p mut Parser) get_type2() Type {
|
|||
func: f
|
||||
cat: .func
|
||||
}
|
||||
p.table.register_type2(fn_typ)
|
||||
p.table.register_type(fn_typ)
|
||||
return fn_typ
|
||||
}
|
||||
// arrays ([]int)
|
||||
|
|
|
@ -103,7 +103,7 @@ fn (p mut Parser) struct_decl() {
|
|||
}
|
||||
// Struct `C.Foo` declaration, no body
|
||||
if is_c && is_struct && p.tok != .lcbr {
|
||||
p.table.register_type2(typ)
|
||||
p.table.register_type(typ)
|
||||
return
|
||||
}
|
||||
p.fspace()
|
||||
|
@ -126,7 +126,7 @@ fn (p mut Parser) struct_decl() {
|
|||
|
||||
|
||||
if !is_ph && p.first_pass() {
|
||||
p.table.register_type2(typ)
|
||||
p.table.register_type(typ)
|
||||
//println('registering 1 nrfields=$typ.fields.len')
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ mut:
|
|||
enum_vals []string
|
||||
gen_types []string
|
||||
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.
|
||||
// This information is needed in the first pass.
|
||||
is_placeholder bool
|
||||
|
@ -397,7 +397,7 @@ fn (p mut Parser) register_type_with_parent(strtyp, parent string) {
|
|||
mod: p.mod
|
||||
is_public: true
|
||||
}
|
||||
p.table.register_type2(typ)
|
||||
p.table.register_type(typ)
|
||||
}
|
||||
|
||||
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 {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue