jitcraft/SemanticAnalysis.cpp
changeset 17 8aa89dd41e25
parent 14 0784ac5cc347
child 20 e020a14e21be
     1.1 --- a/jitcraft/SemanticAnalysis.cpp	Sat Jun 30 22:45:25 2012 -0700
     1.2 +++ b/jitcraft/SemanticAnalysis.cpp	Sat Jun 30 23:40:17 2012 -0700
     1.3 @@ -395,6 +395,8 @@
     1.4      assert(node->arguments()->size() == type->parameters()->length());
     1.5  
     1.6      for (unsigned i = 0; i < node->arguments()->size(); i++) {
     1.7 +        // Note: we don't compute references unless the callee needs a
     1.8 +        // reference type.
     1.9          Expression *expression = node->arguments()->at(i);
    1.10          expression->accept(this);
    1.11  
    1.12 @@ -402,6 +404,12 @@
    1.13          if (!given)
    1.14              return;
    1.15  
    1.16 +        // If it's an IndexExpression, we special case the ability to compute
    1.17 +        // a reference. Maybe we should compute actual Ref types for
    1.18 +        // IndexExpression?
    1.19 +        if (expression->isIndexExpression())
    1.20 +            given = given->contained();
    1.21 +
    1.22          Type *actual = Type::cast(type->parameters()->at(i));
    1.23          assert(TypeCheckParameter(given, actual));
    1.24