示例#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();
}
示例#2
0
文件: expr-id.cpp 项目: NoraAl/banjo
// 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));
}
示例#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);
}
示例#4
0
文件: expr-id.cpp 项目: NoraAl/banjo
// 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));
}
示例#5
0
文件: expr-id.cpp 项目: asutton/banjo
// 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));
}