vfmt: prepare for using .source_name in type_to_str
parent
aea52af9ae
commit
c3626bf2e6
|
@ -334,6 +334,7 @@ pub fn (mut p Parser) parse_generic_template_type(name string) table.Type {
|
||||||
idx = p.table.register_type_symbol(table.TypeSymbol{
|
idx = p.table.register_type_symbol(table.TypeSymbol{
|
||||||
name: name
|
name: name
|
||||||
source_name: name
|
source_name: name
|
||||||
|
mod: p.mod
|
||||||
kind: .any
|
kind: .any
|
||||||
is_public: true
|
is_public: true
|
||||||
})
|
})
|
||||||
|
@ -372,6 +373,7 @@ pub fn (mut p Parser) parse_generic_struct_inst_type(name string) table.Type {
|
||||||
kind: .generic_struct_inst
|
kind: .generic_struct_inst
|
||||||
name: bs_name
|
name: bs_name
|
||||||
source_name: bs_name
|
source_name: bs_name
|
||||||
|
mod: p.mod
|
||||||
info: table.GenericStructInst{
|
info: table.GenericStructInst{
|
||||||
parent_idx: p.table.type_idxs[name]
|
parent_idx: p.table.type_idxs[name]
|
||||||
generic_types: generic_types
|
generic_types: generic_types
|
||||||
|
|
|
@ -1544,12 +1544,12 @@ fn (mut p Parser) import_syms(mut parent ast.Import) {
|
||||||
idx := p.table.add_placeholder_type(name)
|
idx := p.table.add_placeholder_type(name)
|
||||||
typ := table.new_type(idx)
|
typ := table.new_type(idx)
|
||||||
prepend_mod_name := p.prepend_mod(alias)
|
prepend_mod_name := p.prepend_mod(alias)
|
||||||
p.table.register_type_symbol({
|
p.table.register_type_symbol(table.TypeSymbol{
|
||||||
kind: .alias
|
kind: .alias
|
||||||
name: prepend_mod_name
|
name: prepend_mod_name
|
||||||
source_name: prepend_mod_name
|
source_name: prepend_mod_name
|
||||||
parent_idx: idx
|
|
||||||
mod: p.mod
|
mod: p.mod
|
||||||
|
parent_idx: idx
|
||||||
info: table.Alias{
|
info: table.Alias{
|
||||||
parent_type: typ
|
parent_type: typ
|
||||||
language: table.Language.v
|
language: table.Language.v
|
||||||
|
@ -1878,12 +1878,12 @@ fn (mut p Parser) type_decl() ast.TypeDecl {
|
||||||
table.Language.v
|
table.Language.v
|
||||||
}
|
}
|
||||||
prepend_mod_name := p.prepend_mod(name)
|
prepend_mod_name := p.prepend_mod(name)
|
||||||
p.table.register_type_symbol({
|
p.table.register_type_symbol(table.TypeSymbol{
|
||||||
kind: .alias
|
kind: .alias
|
||||||
name: prepend_mod_name
|
name: prepend_mod_name
|
||||||
source_name: prepend_mod_name
|
source_name: prepend_mod_name
|
||||||
parent_idx: pid
|
|
||||||
mod: p.mod
|
mod: p.mod
|
||||||
|
parent_idx: pid
|
||||||
info: table.Alias{
|
info: table.Alias{
|
||||||
parent_type: parent_type
|
parent_type: parent_type
|
||||||
language: language
|
language: language
|
||||||
|
|
|
@ -228,6 +228,7 @@ fn (mut p Parser) struct_decl() ast.StructDecl {
|
||||||
kind: .struct_
|
kind: .struct_
|
||||||
name: name
|
name: name
|
||||||
source_name: name
|
source_name: name
|
||||||
|
mod: p.mod
|
||||||
info: table.Struct{
|
info: table.Struct{
|
||||||
fields: fields
|
fields: fields
|
||||||
is_typedef: attrs.contains('typedef')
|
is_typedef: attrs.contains('typedef')
|
||||||
|
@ -235,7 +236,6 @@ fn (mut p Parser) struct_decl() ast.StructDecl {
|
||||||
is_ref_only: attrs.contains('ref_only')
|
is_ref_only: attrs.contains('ref_only')
|
||||||
generic_types: generic_types
|
generic_types: generic_types
|
||||||
}
|
}
|
||||||
mod: p.mod
|
|
||||||
is_public: is_pub
|
is_public: is_pub
|
||||||
}
|
}
|
||||||
mut ret := 0
|
mut ret := 0
|
||||||
|
|
|
@ -618,10 +618,15 @@ pub fn (mut t Table) find_or_register_fn_type(mod string, f Fn, is_anon, has_dec
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut t Table) add_placeholder_type(name string) int {
|
pub fn (mut t Table) add_placeholder_type(name string) int {
|
||||||
|
mut modname := ''
|
||||||
|
if name.contains('.') {
|
||||||
|
modname = name.all_before_last('.')
|
||||||
|
}
|
||||||
ph_type := TypeSymbol{
|
ph_type := TypeSymbol{
|
||||||
kind: .placeholder
|
kind: .placeholder
|
||||||
name: name
|
name: name
|
||||||
source_name: name
|
source_name: name
|
||||||
|
mod: modname
|
||||||
}
|
}
|
||||||
// println('added placeholder: $name - $ph_type.idx')
|
// println('added placeholder: $name - $ph_type.idx')
|
||||||
return t.register_type_symbol(ph_type)
|
return t.register_type_symbol(ph_type)
|
||||||
|
|
Loading…
Reference in New Issue