new enum step 2

pull/2663/head
Alexander Medvednikov 2019-11-06 06:26:04 +03:00
parent 4d876d1980
commit 8dd335295e
4 changed files with 6 additions and 6 deletions

View File

@ -59,7 +59,7 @@ fn (p mut Parser) enum_decl(no_name bool) {
name: enum_name name: enum_name
mod: p.mod mod: p.mod
parent: 'int' parent: 'int'
cat: TypeCategory.enum_ cat: .enum_
enum_vals: fields.clone() enum_vals: fields.clone()
is_public: is_pub is_public: is_pub
}) })

View File

@ -1219,7 +1219,7 @@ fn (p mut Parser) replace_type_params(f &Fn, ti TypeInst) []string {
fn (p mut Parser) register_vargs_stuct(typ string, len int) string { fn (p mut Parser) register_vargs_stuct(typ string, len int) string {
vargs_struct := 'varg_$typ' vargs_struct := 'varg_$typ'
varg_type := Type{ varg_type := Type{
cat: TypeCategory.struct_, cat: .struct_,
name: vargs_struct, name: vargs_struct,
mod: p.mod mod: p.mod
} }
@ -1299,7 +1299,7 @@ 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_type2(Type{
cat: TypeCategory.struct_, cat: .struct_,
name: typ, name: typ,
mod: p.mod mod: p.mod
}) })

View File

@ -227,7 +227,7 @@ fn (p & Parser) peek() TokenKind {
} }
[inline] fn (p &Parser) peek_token() Token { [inline] fn (p &Parser) peek_token() Token {
if p.token_idx >= p.tokens.len - 2 { if p.token_idx >= p.tokens.len - 2 {
return Token{ tok:TokenKind.eof } return Token{ tok:.eof }
} }
return p.tokens[p.token_idx] return p.tokens[p.token_idx]
} }
@ -639,7 +639,7 @@ fn (p mut Parser) type_decl() {
name: name name: name
parent: parent.name parent: parent.name
mod: p.mod mod: p.mod
cat: TypeCategory.alias cat: .alias
}) })
} }

View File

@ -31,7 +31,7 @@ fn (p mut Parser) get_type2() Type {
name: f.typ_str()// 'fn (int, int) string' name: f.typ_str()// 'fn (int, int) string'
mod: p.mod mod: p.mod
func: f func: f
cat: TypeCategory.func cat: .func
} }
p.table.register_type2(fn_typ) p.table.register_type2(fn_typ)
return fn_typ return fn_typ