Skip to content
Snippets Groups Projects
Unverified Commit 127e8f58 authored by dutor's avatar dutor Committed by GitHub
Browse files

Fix build error due to new type of expression (#184)

parent f4d4efa4
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,8 @@ public:
case Expression::Kind::kRelLE:
case Expression::Kind::kRelGT:
case Expression::Kind::kRelGE:
case Expression::Kind::kRelIn:
case Expression::Kind::kRelNotIn:
case Expression::Kind::kLogicalAnd:
case Expression::Kind::kLogicalOr:
case Expression::Kind::kLogicalXor: {
......@@ -73,7 +75,6 @@ public:
}
return traverse(biExpr->right(), visitor);
}
case Expression::Kind::kRelIn:
case Expression::Kind::kUnaryIncr:
case Expression::Kind::kUnaryDecr:
case Expression::Kind::kUnaryPlus:
......@@ -98,6 +99,12 @@ public:
}
return true;
}
case Expression::Kind::kList: // FIXME(dutor)
case Expression::Kind::kSet:
case Expression::Kind::kMap:
case Expression::Kind::kSubscript: {
return false;
}
}
DLOG(FATAL) << "Impossible expression kind " << static_cast<int>(expr->kind());
return false;
......@@ -262,6 +269,8 @@ public:
case Expression::Kind::kRelLE:
case Expression::Kind::kRelGT:
case Expression::Kind::kRelGE:
case Expression::Kind::kRelIn:
case Expression::Kind::kRelNotIn:
case Expression::Kind::kLogicalAnd:
case Expression::Kind::kLogicalOr:
case Expression::Kind::kLogicalXor: {
......@@ -276,7 +285,6 @@ public:
}
return true;
}
case Expression::Kind::kRelIn:
case Expression::Kind::kUnaryIncr:
case Expression::Kind::kUnaryDecr:
case Expression::Kind::kUnaryPlus:
......@@ -309,6 +317,12 @@ public:
}
return true;
}
case Expression::Kind::kList: // FIXME(dutor)
case Expression::Kind::kSet:
case Expression::Kind::kMap:
case Expression::Kind::kSubscript: {
return false;
}
} // switch
DLOG(FATAL) << "Impossible expression kind " << static_cast<int>(current->kind());
return false;
......
......@@ -848,7 +848,12 @@ void GoValidator::extractPropExprs(const Expression* expr) {
case Expression::Kind::kSymProperty:
case Expression::Kind::kUnaryIncr:
case Expression::Kind::kUnaryDecr:
case Expression::Kind::kRelIn: {
case Expression::Kind::kList: // FIXME(dutor)
case Expression::Kind::kSet:
case Expression::Kind::kMap:
case Expression::Kind::kSubscript:
case Expression::Kind::kRelIn:
case Expression::Kind::kRelNotIn: {
LOG(FATAL) << "Not support " << expr->kind();
break;
}
......@@ -941,7 +946,12 @@ std::unique_ptr<Expression> GoValidator::rewriteToInputProp(Expression* expr) {
case Expression::Kind::kSymProperty:
case Expression::Kind::kUnaryIncr:
case Expression::Kind::kUnaryDecr:
case Expression::Kind::kRelIn: {
case Expression::Kind::kList: // FIXME(dutor)
case Expression::Kind::kSet:
case Expression::Kind::kMap:
case Expression::Kind::kSubscript:
case Expression::Kind::kRelIn:
case Expression::Kind::kRelNotIn: {
LOG(FATAL) << "Not support " << expr->kind();
break;
}
......
......@@ -644,6 +644,7 @@ std::unique_ptr<Expression> UpdateValidator::rewriteSymExpr(Expression* expr,
case Expression::Kind::kRelGT:
case Expression::Kind::kRelGE:
case Expression::Kind::kRelIn:
case Expression::Kind::kRelNotIn:
case Expression::Kind::kLogicalAnd:
case Expression::Kind::kLogicalOr:
case Expression::Kind::kLogicalXor: {
......@@ -727,7 +728,11 @@ std::unique_ptr<Expression> UpdateValidator::rewriteSymExpr(Expression* expr,
case Expression::Kind::kVarProperty:
case Expression::Kind::kInputProperty:
case Expression::Kind::kUnaryIncr:
case Expression::Kind::kUnaryDecr: {
case Expression::Kind::kUnaryDecr:
case Expression::Kind::kList: // FIXME(dutor)
case Expression::Kind::kSet:
case Expression::Kind::kMap:
case Expression::Kind::kSubscript: {
hasWrongType = true;
break;
}
......
......@@ -312,13 +312,14 @@ StatusOr<Value::Type> Validator::deduceExprType(const Expression* expr) const {
case Expression::Kind::kLogicalOr: {
DETECT_BIEXPR_TYPE(||)
}
case Expression::Kind::kRelIn: {
case Expression::Kind::kRelIn:
case Expression::Kind::kRelNotIn: {
auto biExpr = static_cast<const BinaryExpression*>(expr);
NG_RETURN_IF_ERROR(deduceExprType(biExpr->left()));
auto right = deduceExprType(biExpr->right());
NG_RETURN_IF_ERROR(right);
if (right.value() != Value::Type::LIST) {
if (right.value() != Value::Type::LIST) { // FIXME(dutor)
std::stringstream ss;
ss << "`" << expr->toString() << "' is not a valid expression, "
<< "expected `LIST' but `" << right.value() << "' was given.";
......@@ -508,6 +509,18 @@ StatusOr<Value::Type> Validator::deduceExprType(const Expression* expr) const {
// TODO: not only dataset
return Value::Type::DATASET;
}
case Expression::Kind::kList: {
return Value::Type::LIST;
}
case Expression::Kind::kSet: {
return Value::Type::SET;
}
case Expression::Kind::kMap: {
return Value::Type::MAP;
}
case Expression::Kind::kSubscript: {
return Value::Type::LIST; // FIXME(dutor)
}
}
return Status::SemanticError("Unknown expression kind: %ld",
static_cast<int64_t>(expr->kind()));
......@@ -612,7 +625,12 @@ Status Validator::deduceProps(const Expression* expr) {
case Expression::Kind::kSymProperty:
case Expression::Kind::kUnaryIncr:
case Expression::Kind::kUnaryDecr:
case Expression::Kind::kRelIn: {
case Expression::Kind::kList:
case Expression::Kind::kSet:
case Expression::Kind::kMap:
case Expression::Kind::kSubscript:
case Expression::Kind::kRelIn:
case Expression::Kind::kRelNotIn: {
// TODO:
std::stringstream ss;
ss << "Not supported expression kind for type deduction: " << expr->toString();
......@@ -639,6 +657,7 @@ bool Validator::evaluableExpr(const Expression* expr) const {
case Expression::Kind::kRelGT:
case Expression::Kind::kRelGE:
case Expression::Kind::kRelIn:
case Expression::Kind::kRelNotIn:
case Expression::Kind::kLogicalAnd:
case Expression::Kind::kLogicalOr:
case Expression::Kind::kLogicalXor: {
......@@ -679,7 +698,11 @@ bool Validator::evaluableExpr(const Expression* expr) const {
case Expression::Kind::kInputProperty:
case Expression::Kind::kSymProperty:
case Expression::Kind::kUnaryIncr:
case Expression::Kind::kUnaryDecr: {
case Expression::Kind::kUnaryDecr:
case Expression::Kind::kList: // FIXME(dutor)
case Expression::Kind::kSet:
case Expression::Kind::kMap:
case Expression::Kind::kSubscript: {
return false;
}
}
......
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