Bug fix with compound initializers (issue189060)


cku...@...
 


larry...@...
 

Reviewers: ,

Message:
Review at http://codereview.appspot.com/189060

Description:
Bug introduced with r507 when I overhauled compound initializers in
ASTvariable_declaration. Forgot one place where they needed to be
handled.


Please review this at http://codereview.appspot.com/189060

Affected files:
M src/liboslcomp/codegen.cpp
M src/liboslcomp/oslcomp.cpp


Index: src/liboslcomp/codegen.cpp
===================================================================
--- src/liboslcomp/codegen.cpp (revision 517)
+++ src/liboslcomp/codegen.cpp (working copy)
@@ -515,7 +515,14 @@

if (init() && sym->fieldid() < 0) {
// Normal vars with initializers -- generate them
- for (ASTNode::ref i = init(); i; i = i->next()) {
+
+ // If it's a compound initializer, look at the individual pieces
+ ref init = this->init();
+ if (init->nodetype() == compound_initializer_node) {
+ init = ((ASTcompound_initializer *)init.get())->initlist();
+ }
+
+ for (ASTNode::ref i = init; i; i = i->next()) {
completed &= param_one_default_literal (sym, i.get(), out);
}
} else {
Index: src/liboslcomp/oslcomp.cpp
===================================================================
--- src/liboslcomp/oslcomp.cpp (revision 517)
+++ src/liboslcomp/oslcomp.cpp (working copy)
@@ -601,7 +601,7 @@
}

if (m_ircode.size() == 0) // If no code, still need a code marker
- oso ("code main\n");
+ oso ("code ___main___\n");

oso ("\tend\n");