src/SemanticAnalysis.cpp
changeset 188 bab29bcec7fe
parent 187 9308d52205a0
child 190 dd04fce774cd
     1.1 --- a/src/SemanticAnalysis.cpp	Sun Sep 16 19:02:23 2012 -0700
     1.2 +++ b/src/SemanticAnalysis.cpp	Sun Sep 16 21:34:10 2012 -0700
     1.3 @@ -1420,13 +1420,22 @@
     1.4          } else {
     1.5              Local<Type> actual(zone_, type->parameterAt(i));
     1.6  
     1.7 -            if (expression->isIndexExpression() && actual->isArray()) {
     1.8 -                // We special case the ability to pass x[y] into x[], which
     1.9 -                // creates an array slice. We only do this if we know the
    1.10 -                // assignment would otherwise not type-check.
    1.11 -                IndexExpression *index = expression->toIndexExpression();
    1.12 -                if (index->left()->type()->levels() == actual->levels())
    1.13 -                    given = index->left()->type();
    1.14 +            if (expression->isIndexExpression()) {
    1.15 +                // Disabled until we can make it work.
    1.16 +#if 0
    1.17 +                if (actual->isArray()) {
    1.18 +                    // We special case the ability to pass x[y] into x[], which
    1.19 +                    // creates an array slice. We only do this if we know the
    1.20 +                    // assignment would otherwise not type-check.
    1.21 +                    IndexExpression *index = expression->toIndexExpression();
    1.22 +                    if (index->left()->type()->levels() == actual->levels())
    1.23 +                        given = index->left()->type();
    1.24 +                } else
    1.25 +#endif
    1.26 +                if (actual->isReference()) {
    1.27 +                    cc_.reportError(expression->pos(), Message_CannotComputeIndexRef);
    1.28 +                    return;
    1.29 +                }
    1.30              }
    1.31  
    1.32              if (!typeCheckParameter(expression, given, actual))