cgen: 7 errors left

pull/4084/head
Alexander Medvednikov 2020-03-20 20:22:34 +01:00
parent e6a679b019
commit 8077a7534e
2 changed files with 6 additions and 2 deletions

View File

@ -1696,10 +1696,14 @@ fn (p mut Parser) match_expr() ast.MatchExpr {
else if p.tok.kind == .name && (p.tok.lit[0].is_capital() || p.peek_tok.kind == .dot) { else if p.tok.kind == .name && (p.tok.lit[0].is_capital() || p.peek_tok.kind == .dot) {
// if sym.kind == .sum_type { // if sym.kind == .sum_type {
// p.warn('is sum') // p.warn('is sum')
// TODO `exprs << ast.Type{...}`
typ := p.parse_type() typ := p.parse_type()
exprs << ast.Type{ x := ast.Type{
typ: typ typ: typ
} }
mut expr := ast.Expr{}
expr = x
exprs << expr
p.scope.register_var(ast.Var{ p.scope.register_var(ast.Var{
name: 'it' name: 'it'
typ: table.type_to_ptr(typ) typ: table.type_to_ptr(typ)

View File

@ -232,7 +232,7 @@ pub fn (t mut Table) register_builtin_type_symbol(typ TypeSymbol) int {
if existing_idx > 0 { if existing_idx > 0 {
if existing_idx >= string_type_idx { if existing_idx >= string_type_idx {
if existing_idx == string_type_idx { if existing_idx == string_type_idx {
existing_type := &t.types[existing_idx] existing_type := t.types[existing_idx]
t.types[existing_idx] = { t.types[existing_idx] = {
typ | typ |
kind:existing_type.kind kind:existing_type.kind