Commit d98960b4 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #1086 from undingen/fix_boolop_parsing

Fix cpython parser bool operation conversion
parents 8c850f64 9eabc931
...@@ -139,7 +139,7 @@ public: ...@@ -139,7 +139,7 @@ public:
AST_TYPE::AST_TYPE convert(boolop_ty op) { AST_TYPE::AST_TYPE convert(boolop_ty op) {
switch (op) { switch (op) {
CASE(Add); CASE(And);
CASE(Or); CASE(Or);
} }
// GCC wants this: // GCC wants this:
......
...@@ -1106,11 +1106,11 @@ AST_Module* parse_file(const char* fn, FutureFlags inherited_flags) { ...@@ -1106,11 +1106,11 @@ AST_Module* parse_file(const char* fn, FutureFlags inherited_flags) {
const char* getMagic() { const char* getMagic() {
if (ENABLE_CPYTHON_PARSER) if (ENABLE_CPYTHON_PARSER)
return "a\nCO"; return "a\nCP";
else if (ENABLE_PYPA_PARSER) else if (ENABLE_PYPA_PARSER)
return "a\ncO"; return "a\ncP";
else else
return "a\nco"; return "a\ncp";
} }
#define MAGIC_STRING_LENGTH 4 #define MAGIC_STRING_LENGTH 4
......
...@@ -1560,6 +1560,9 @@ bool PrintVisitor::visit_langprimitive(AST_LangPrimitive* node) { ...@@ -1560,6 +1560,9 @@ bool PrintVisitor::visit_langprimitive(AST_LangPrimitive* node) {
case AST_LangPrimitive::HASNEXT: case AST_LangPrimitive::HASNEXT:
stream << "HASNEXT"; stream << "HASNEXT";
break; break;
case AST_LangPrimitive::PRINT_EXPR:
stream << "PRINT_EXPR";
break;
default: default:
RELEASE_ASSERT(0, "%d", node->opcode); RELEASE_ASSERT(0, "%d", node->opcode);
} }
......
...@@ -746,9 +746,11 @@ private: ...@@ -746,9 +746,11 @@ private:
if (node->op_type == AST_TYPE::Or) { if (node->op_type == AST_TYPE::Or) {
br->iftrue = crit_break_block; br->iftrue = crit_break_block;
br->iffalse = next_block; br->iffalse = next_block;
} else { } else if (node->op_type == AST_TYPE::And) {
br->iffalse = crit_break_block; br->iffalse = crit_break_block;
br->iftrue = next_block; br->iftrue = next_block;
} else {
RELEASE_ASSERT(0, "");
} }
curblock = crit_break_block; curblock = crit_break_block;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment