Exemplo n.º 1
0
// Perform qualified lookup to resolve the declaration referred to by obj.n.
Expr&
make_member_reference(Context& cxt, Expr& obj, Simple_id& name)
{
  Type& type = obj.type();
  Decl_list decls = qualified_lookup(cxt, type, name);
  if (decls.size() == 1)
    return make_member_reference(cxt, obj, decls.front());
  lingo_unreachable();
}
Exemplo n.º 2
0
// Perform unqualified lookup.
//
// TODO: Allow an lookup to fail, indicating that we could not find
// a name. In function calls, this could be used to perform class
// lookup for member functions.
Expr&
make_reference(Context& cxt, Simple_id& id)
{
  Decl_list decls = unqualified_lookup(cxt, id);
  if (decls.size() == 1)
    return make_decl_ref(cxt, decls.front());
  else
    return make_ovl_ref(cxt, id, std::move(decls));
}
Exemplo n.º 3
0
// Perform unqualified lookup.
Expr&
make_reference(Context& cxt, Simple_id& id)
{
  Decl_list decls = unqualified_lookup(cxt, id);
  if (decls.size() == 1)
    return make_reference(cxt, decls.front());

  // TODO: Return a reference to an overload set.
  banjo_unhandled_case(id);
}
Exemplo n.º 4
0
// Perform qualified lookup to resolve the declaration referred to by obj.n.
//
// TODO: Allow class lookup to find 
static Expr&
make_member_ref(Context& cxt, Expr& obj, Simple_id& name)
{
  Type& type = obj.type();
  Decl_list decls = qualified_lookup(cxt, type, name);
  if (decls.size() == 1)
    return make_member_decl_ref(cxt, obj, decls.front());
  else
    return make_member_ovl_ref(cxt, obj, name, std::move(decls));
}
Exemplo n.º 5
0
// Perform qualified lookup to resolve the declaration referred to by obj.n.
//
// FIXME: This needs to perform class lookup, not qualified lookup.
static Expr&
make_member_ref(Context& cxt, Expr& obj, Simple_id& name)
{
  Type& type = obj.type();
  Decl_list decls = qualified_lookup(cxt, type, name);
  if (decls.empty()) {
    error(cxt, "no matching declaration for '{}'", name);
    throw Lookup_error();
  }
  if (decls.size() == 1)
    return make_resolved_mem_ref(cxt, obj, decls.front());
  else
    return make_mem_overload_ref(cxt, obj, name, std::move(decls));
}