예제 #1
0
bool external_function::mustCopyInputNodes(
    expr* fo,
    csize input) const
{
  bool res = function::mustCopyInputNodes(fo, input);

  if (res == false)
    return res;

  AnnotationInternal* ann = NULL;

  if (theAnnotationList)
    ann = theAnnotationList->get(AnnotationInternal::zann_must_copy_input_nodes);

  if (ann != NULL)
  {
    csize numLiterals = ann->getNumLiterals();

    for (csize i = 0; i < numLiterals; ++i)
    {
      if (ann->getLiteral(i)->getLongValue() == (unsigned int)input + 1)
        return true;
    }

    return false;
  }

  return true;
}
예제 #2
0
void AnnotationList::checkLiterals(DeclarationKind k, const QueryLoc& loc) const
{
  for (Annotations::const_iterator ite = theAnnotationList.begin();
       ite != theAnnotationList.end();
       ++ite)
  {
    AnnotationInternal* lAnn = *ite;
    switch (lAnn->getId())
    {
      case AnnotationInternal::zann_exclude_from_cache_key:
      case AnnotationInternal::zann_compare_with_deep_equal:
        //One or more integers
        if (!lAnn->getNumLiterals())
        {
          RAISE_ERROR(zerr::ZXQP0062_INVALID_ANNOTATION_LITERALS_NUMBER, loc,
              ERROR_PARAMS(
                  AnnotationInternal::lookup(lAnn->getId())->getStringValue(),
                  ZED(ZXQP0062_ONE_OR_MORE_LITERALS)));
        }
        for (csize i=0; i<lAnn->getNumLiterals(); ++i)
          checkLiteralType(lAnn, lAnn->getLiteral(i), store::XS_INTEGER, loc);
        break;
      default:
        break;
    }
  }
}