virtual void visitBlockNode(BlockNode * node) { if (currentTabNum >= 0) { out<< "{"<< endl; } ++currentTabNum; visitScope(node->scope()); for (size_t i = 0; i < node->nodes(); ++i) { addIndent(); AstNode * currentNode = node->nodeAt(i); currentNode->visit(this); if (currentNode->isCallNode() || currentNode->isLoadNode() || currentNode->isNativeCallNode() || currentNode->isPrintNode() || currentNode->isReturnNode() || currentNode->isStoreNode()) { out<< ";"<< endl; } } --currentTabNum; if (currentTabNum >= 0) { addIndent(); out<< "}"<< endl; } }
virtual void visitBlockNode(BlockNode *node) { bool topLevel = node->scope()->parent()->parent() == NULL; if (!topLevel) { out << "{" << endl; } printVars(node->scope()); for (uint32_t i = 0; i < node->nodes(); i++) { AstNode *currentNode = node->nodeAt(i); currentNode->visit(this); if (currentNode->isLoadNode() || currentNode->isStoreNode() || currentNode->isReturnNode() || currentNode->isCallNode() || currentNode->isNativeCallNode() || currentNode->isPrintNode()) { out << ";" << endl; } } if (!topLevel) { out << "}" << endl; } }