Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions ASTNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "pyc_module.h"
#include <list>
#include <deque>
#include <string>

/* Similar interface to PycObject, so PycRef can work on it... *
* However, this does *NOT* mean the two are interchangeable! */
Expand All @@ -18,7 +19,7 @@ class ASTNode {
NODE_COMPREHENSION, NODE_LOADBUILDCLASS, NODE_AWAITABLE,
NODE_FORMATTEDVALUE, NODE_JOINEDSTR, NODE_CONST_MAP,
NODE_ANNOTATED_VAR, NODE_CHAINSTORE, NODE_TERNARY,
NODE_KW_NAMES_MAP,
NODE_KW_NAMES_MAP, NODE_UNSUPPORTED,

// Empty node types
NODE_LOCALS,
Expand Down Expand Up @@ -105,6 +106,17 @@ class ASTObject : public ASTNode {
PycRef<PycObject> m_obj;
};

class ASTUnsupported : public ASTNode {
public:
ASTUnsupported(std::string text)
: ASTNode(NODE_UNSUPPORTED), m_text(std::move(text)) { }

const std::string& text() const { return m_text; }

private:
std::string m_text;
};


class ASTUnary : public ASTNode {
public:
Expand Down Expand Up @@ -573,13 +585,17 @@ class ASTCondBlock : public ASTBlock {

ASTCondBlock(ASTBlock::BlkType blktype, int end, PycRef<ASTNode> cond,
bool negative = false)
: ASTBlock(blktype, end), m_cond(std::move(cond)), m_negative(negative) { }
: ASTBlock(blktype, end), m_cond(std::move(cond)), m_except_var(),
m_negative(negative) { }

PycRef<ASTNode> cond() const { return m_cond; }
PycRef<ASTNode> exceptVar() const { return m_except_var; }
bool negative() const { return m_negative; }
void setExceptVar(PycRef<ASTNode> except_var) { m_except_var = std::move(except_var); }

private:
PycRef<ASTNode> m_cond;
PycRef<ASTNode> m_except_var;
bool m_negative;
};

Expand Down Expand Up @@ -617,6 +633,7 @@ class ASTContainerBlock : public ASTBlock {
int finally() const { return m_finally; }
int except() const { return m_except; }

void setFinally(int finally) { m_finally = finally; }
void setExcept(int except) { m_except = except; }

private:
Expand Down
Loading