bool IdAccessorExpression::operator==(const ASTNode &node) const { auto &idacc = dynamic_cast<const IdAccessorExpression &>(node); return astNodeType() == node.astNodeType() && *idacc.primaryExpression == *primaryExpression && *idacc.accessor == *accessor; }
bool BinaryExpression::operator==(const ASTNode &node) const { auto &&binexpr = dynamic_cast<const BinaryExpression &>(node); return astNodeType() == node.astNodeType() && *binexpr.optr == *optr && *left == *binexpr.left && *right == *binexpr.right; }
bool ValDefStatement::operator==(const ASTNode &node) const { auto &valDef = dynamic_cast<const ValDefStatement &>(node); return astNodeType() == node.astNodeType() && valDef.name == name && *valDef.value == *value; }
bool AssignmentExpression::operator==(const ASTNode &node) const { auto &assign = dynamic_cast<const AssignmentExpression &>(node); return astNodeType() == node.astNodeType() && name == assign.name && *value == *assign.value; }
bool Param::operator==(const ASTNode &node) const { auto ¶m = dynamic_cast<const Param &>(node); return astNodeType() == node.astNodeType() && paramName == param.paramName && annotatedType == param.annotatedType && type == param.type; }
bool CompoundStatement::operator==(const ASTNode &node) const { auto &stmt = dynamic_cast<const CompoundStatement &>(node); return astNodeType() == node.astNodeType() && std::equal(begin(statements), end(statements), begin(stmt.statements), ASTComparator); }
bool IfStatement::operator==(const ASTNode &node) const { auto &ifstmt = dynamic_cast<const IfStatement &>(node); return astNodeType() == node.astNodeType() && *testing == *ifstmt.testing && *consequence == *ifstmt.consequence && ((alternative == nullptr && ifstmt.alternative == nullptr) || *alternative == *ifstmt.alternative); }
bool FunctionDef::operator==(const ASTNode &node) const { auto &funDef = dynamic_cast<const FunctionDef &>(node); return astNodeType() == node.astNodeType() && funDef.funName == funName && std::equal(begin(params), end(params), begin(funDef.params), ASTComparator) && *funDef.body == *body; }
bool Module::operator==(const ASTNode &node) const { auto &mod = dynamic_cast<const Module &>(node); return astNodeType() == node.astNodeType() && name == mod.name && definitions.size() == mod.definitions.size() && std::equal(std::begin(definitions), std::end(definitions), begin(mod.definitions), ASTComparator); }
bool FunCallExpression::operator==(const ASTNode &node) const { auto &funCall = dynamic_cast<const FunCallExpression &>(node); return astNodeType() == node.astNodeType() && *funCall.primaryExpression == *primaryExpression && std::equal(begin(arguments), end(arguments), begin(funCall.arguments), ASTComparator); }
bool BooleanValue::operator==(const ASTNode& node) const { auto &val = dynamic_cast<const BooleanValue&>(node); return astNodeType() == node.astNodeType() && value == val.value; }
bool StringValue::operator==(const ASTNode& node) const { auto &strVal = dynamic_cast<const StringValue &>(node); return astNodeType() == node.astNodeType() && strVal.value == value; }
bool IntegerValue::operator==(const ASTNode &node) const { auto &intVal = dynamic_cast<const IntegerValue &>(node); return astNodeType() == node.astNodeType() && intVal.value == value; }
bool ValDef::operator==(const ASTNode& node) const { auto &valDef = dynamic_cast<const ValDef&>(node); return astNodeType() == node.astNodeType() && valDef.body->operator==(*(valDef.body)); }
bool SimpleStatement::operator==(const ASTNode &node) const { auto &simple = dynamic_cast<const SimpleStatement &>(node); return astNodeType() == node.astNodeType() && *expression == *simple.expression; }
bool IdExpression::operator==(const ASTNode &node) const { auto &idexpr = dynamic_cast<const IdExpression &>(node); return astNodeType() == node.astNodeType() && idexpr.id == id; }
bool ReturnStatement::operator==(const ASTNode &node) const { auto &ret = dynamic_cast<const ReturnStatement &>(node); return astNodeType() == node.astNodeType() && *expression == *ret.expression; }