Basic handling of try/except/finally blocks.

This commit is contained in:
Darryl Pogue
2011-10-01 19:40:34 -07:00
parent ac4d254a73
commit 70160f8a28
4 changed files with 102 additions and 3 deletions

View File

@@ -408,7 +408,7 @@ public:
enum BlkType {
BLK_MAIN, BLK_IF, BLK_ELSE, BLK_ELIF, BLK_TRY,
BLK_EXCEPT_CONTAINER, BLK_EXCEPT, BLK_FINALLY,
BLK_CONTAINER, BLK_EXCEPT, BLK_FINALLY,
BLK_WHILE, BLK_FOR
};
@@ -471,4 +471,19 @@ private:
PycRef<ASTNode> m_idx;
};
class ASTContainerBlock : public ASTBlock {
public:
ASTContainerBlock(bool hasFinally, bool hasExcept = false)
: ASTBlock(ASTBlock::BLK_CONTAINER, 0), m_hasFinally(hasFinally), m_hasExcept(hasExcept) { }
bool hasFinally() const { return m_hasFinally; }
bool hasExcept() const { return m_hasExcept; }
void setHasExcept(bool hasExcept) { m_hasExcept = hasExcept; }
private:
bool m_hasFinally;
bool m_hasExcept;
};
#endif