Bug fix
This commit is contained in:
parent
fc16c077d9
commit
2049826870
@ -266,14 +266,17 @@ static char *ast_dumps(AST *tlc, AST *s) {
|
|||||||
} else if(s->nodeKind == AST_STMT_EXPR) {
|
} else if(s->nodeKind == AST_STMT_EXPR) {
|
||||||
return ast_dumpe(tlc, s->stmtExpr.expr);
|
return ast_dumpe(tlc, s->stmtExpr.expr);
|
||||||
} else if(s->nodeKind == AST_STMT_DECL) {
|
} else if(s->nodeKind == AST_STMT_DECL) {
|
||||||
char *a = type_to_string(s->stmtDecl.thing->type);
|
ScopeItem *si = s->stmtDecl.thing;
|
||||||
|
const char *name = si->kind == SCOPEITEM_VAR ? si->data.var.name : si->data.symbol.name;
|
||||||
|
|
||||||
|
char *a = type_to_string(si->type);
|
||||||
char *c;
|
char *c;
|
||||||
if(s->stmtDecl.expression) {
|
if(s->stmtDecl.expression) {
|
||||||
char *b = ast_dumpe(tlc, s->stmtDecl.expression);
|
char *b = ast_dumpe(tlc, s->stmtDecl.expression);
|
||||||
c = malp("%s %s = %s;", a, s->stmtDecl.thing->data.var.name, b);
|
c = malp("%s %s = %s;", a, name, b);
|
||||||
free(b);
|
free(b);
|
||||||
} else {
|
} else {
|
||||||
c = malp("%s %s;", a, s->stmtDecl.thing->data.var.name);
|
c = malp("%s %s;", a, name);
|
||||||
}
|
}
|
||||||
free(a);
|
free(a);
|
||||||
return c;
|
return c;
|
||||||
|
Loading…
Reference in New Issue
Block a user