jitcraft/SemanticAnalysis.cpp
changeset 83 79265b56316e
parent 80 c58dff4e560c
child 85 06a0015b6a5c
     1.1 --- a/jitcraft/SemanticAnalysis.cpp	Wed Jul 18 21:46:29 2012 -0700
     1.2 +++ b/jitcraft/SemanticAnalysis.cpp	Wed Jul 18 22:02:11 2012 -0700
     1.3 @@ -375,6 +375,27 @@
     1.4  }
     1.5  
     1.6  void
     1.7 +SemanticAnalysis::visit(TernaryExpression *node)
     1.8 +{
     1.9 +    Local<Type> type(zone_, visitForLoad(node->condition()));
    1.10 +    if (!type)
    1.11 +        return;
    1.12 +
    1.13 +    if (!canTest(node->condition(), type))
    1.14 +        return;
    1.15 +
    1.16 +    Local<Type> left(zone_, visitForLoad(node->left()));
    1.17 +    Local<Type> right(zone_, visitForLoad(node->right()));
    1.18 +    if (!left || !right)
    1.19 +        return;
    1.20 +
    1.21 +    if (left != right) {
    1.22 +        binaryTypeError(node, TOK_QMARK, left, right);
    1.23 +        return;
    1.24 +    }
    1.25 +}
    1.26 +
    1.27 +void
    1.28  SemanticAnalysis::visit(BinaryExpression *node)
    1.29  {
    1.30      Local<Type> left(zone_, visitForLoad(node->left()));