예제 #1
0
파일: Resolver.cpp 프로젝트: relrod/magpie
 void Resolver::visit(RecordLValue& lvalue, int dummy)
 {
   // Recurse into the fields.
   for (int i = 0; i < lvalue.fields().count(); i++)
   {
     lvalue.fields()[i].value->accept(*this, dummy);
   }
 }
예제 #2
0
  void ExprCompiler::visit(RecordLValue& lvalue, int value)
  {
    // TODO(bob): Lot of copy/paste between this and RecordPattern.
    // Recurse into the fields.
    for (int i = 0; i < lvalue.fields().count(); i++)
    {
      // TODO(bob): Could be faster and skip this if the field is a wildcard.

      // Test and destructure the field. This takes two instructions to encode
      // all of the operands.
      int field = makeTemp();
      int symbol = compiler_.addSymbol(lvalue.fields()[i].name);

      write(lvalue.fields()[i].value->pos(), OP_GET_FIELD,
            value, symbol, field);

      // Recurse into the record, using that field.
      lvalue.fields()[i].value->accept(*this, field);

      releaseTemp(); // field.
    }
  }