コード例 #1
0
    boost::optional<data::event_data> next()
    {
      boost::optional<data::event_data> event = _events.next();

      if (event)
      {
        if (const boost::optional<data::type> type = type_of(*event))
        {
          if (const auto t = trim_wrap_type(*type))
          {
            if (is_template_type(*t))
            {
              set_type(*event, *t);
            }
            else
            {
              // All of the below optionals are expected to hold a value
              event = data::event_details<data::event_kind::non_template_type>{
                  {*t, *point_of_event(*event), *source_location(*event)},
                  *timestamp(*event)};
            }
          }
        }
      }

      return event;
    }
コード例 #2
0
ファイル: generate.c プロジェクト: swansontec/outline2c
/**
 * Performs code-generation for a lookup node.
 */
int generate_lookup(Pool *pool, FILE *out, AstLookup *p)
{
  int rv;

  /* If a tag satisfies the lookup, generate that: */
  rv = generate_lookup_tag(pool, out, p);
  if (rv == 1) return 1;
  if (rv == 0) return 0;

  /* If that didn't work, try the built-in transforms: */
  if (generate_lookup_builtin(pool, out, p))
    return 1;

  source_location(stderr, p->name.p);
  fprintf(stderr, "error: Could not find a transform named \"%s\".\n",
    string_copy(pool, p->name).p);
  return 0;
}