if (!fn_return_ty->is_unit ())
{
HirId id = function_body.get_mappings ().get_hirid ();
- Location lvalue_locus = function_body.get_locus ();
- Location rvalue_locus = locus;
+ location_t lvalue_locus = function_body.get_locus ();
+ location_t rvalue_locus = locus;
TyTy::BaseType *expected = fn_return_ty;
TyTy::BaseType *actual = nullptr;
auto param_tyty = tyty_param.second;
auto compiled_param_type = TyTyResolveCompile::compile (ctx, param_tyty);
- Location param_locus = referenced_param.get_locus ();
+ location_t param_locus = referenced_param.get_locus ();
Bvariable *compiled_param_var
= CompileFnParam::compile (ctx, fndecl, &referenced_param,
compiled_param_type, param_locus);
= compile_locals_for_block (ctx, *rib, fndecl);
tree enclosing_scope = NULL_TREE;
- Location start_location = function_body->get_locus ();
- Location end_location = function_body->get_end_locus ();
+ location_t start_location = function_body->get_locus ();
+ location_t end_location = function_body->get_end_locus ();
tree code_block = ctx->get_backend ()->block (fndecl, enclosing_scope, locals,
start_location, end_location);
std::vector<Bvariable *> locals;
tree enclosing_scope = NULL_TREE;
- Location start_location = const_value_expr->get_locus ();
- Location end_location = const_value_expr->get_locus ();
+ location_t start_location = const_value_expr->get_locus ();
+ location_t end_location = const_value_expr->get_locus ();
if (is_block_expr)
{
HIR::BlockExpr *function_body
tree
HIRCompileBase::resolve_method_address (TyTy::FnType *fntype,
TyTy::BaseType *receiver,
- Location expr_locus)
+ location_t expr_locus)
{
rust_debug_loc (expr_locus, "resolve_method_address for %s and receiver %s",
fntype->debug_str ().c_str (),
Context *get_context () { return ctx; }
tree coercion_site (HirId id, tree rvalue, TyTy::BaseType *actual,
- TyTy::BaseType *expected, Location lvalue_locus,
- Location rvalue_locus);
+ TyTy::BaseType *expected, location_t lvalue_locus,
+ location_t rvalue_locus);
tree coercion_site1 (tree rvalue, TyTy::BaseType *actual,
- TyTy::BaseType *expected, Location lvalue_locus,
- Location rvalue_locus);
+ TyTy::BaseType *expected, location_t lvalue_locus,
+ location_t rvalue_locus);
tree coerce_to_dyn_object (tree compiled_ref, const TyTy::BaseType *actual,
const TyTy::DynamicObjectType *ty,
const TyTy::BaseType *receiver, const TyTy::BaseType *root,
location_t locus);
- bool verify_array_capacities (tree ltype, tree rtype, Location ltype_locus,
- Location rtype_locus);
+ bool verify_array_capacities (tree ltype, tree rtype, location_t ltype_locus,
+ location_t rtype_locus);
tree query_compile (HirId ref, TyTy::BaseType *lookup,
const HIR::PathIdentSegment &final_segment,
const Analysis::NodeMapping &mappings,
- Location expr_locus, bool is_qualified_path);
+ location_t expr_locus, bool is_qualified_path);
tree resolve_adjustements (std::vector<Resolver::Adjustment> &adjustments,
tree expression, location_t locus);
tree expression, location_t locus);
tree resolve_method_address (TyTy::FnType *fntype, TyTy::BaseType *receiver,
- Location expr_locus);
+ location_t expr_locus);
void compile_function_body (tree fndecl, HIR::BlockExpr &function_body,
TyTy::BaseType *fn_return_ty);
{
fncontext fnctx = ctx->peek_fn ();
tree fndecl = fnctx.fndecl;
- Location start_location = expr.get_locus ();
- Location end_location = expr.get_end_locus ();
+ location_t start_location = expr.get_locus ();
+ location_t end_location = expr.get_end_locus ();
auto body_mappings = expr.get_mappings ();
Resolver::Rib *rib = nullptr;
// else block
std::vector<Bvariable *> locals;
- Location start_location = expr.get_else_block ()->get_locus ();
- Location end_location = expr.get_else_block ()->get_locus (); // FIXME
+ location_t start_location = expr.get_else_block ()->get_locus ();
+ location_t end_location = expr.get_else_block ()->get_locus (); // FIXME
tree enclosing_scope = ctx->peek_enclosing_scope ();
tree else_block = ctx->get_backend ()->block (fndecl, enclosing_scope, locals,
start_location, end_location);
if (expr.has_return_expr ())
{
HirId id = expr.get_mappings ().get_hirid ();
- Location rvalue_locus = expr.return_expr->get_locus ();
+ location_t rvalue_locus = expr.return_expr->get_locus ();
TyTy::BaseType *expected = fncontext.retty;
- Location lvalue_locus
+ location_t lvalue_locus
= ctx->get_mappings ()->lookup_location (expected->get_ref ());
TyTy::BaseType *actual = nullptr;
}
std::vector<Bvariable *> locals;
- Location start_location = expr.get_loop_block ()->get_locus ();
- Location end_location = expr.get_loop_block ()->get_locus (); // FIXME
+ location_t start_location = expr.get_loop_block ()->get_locus ();
+ location_t end_location = expr.get_loop_block ()->get_locus (); // FIXME
tree enclosing_scope = ctx->peek_enclosing_scope ();
tree loop_block
// setup the end label so the cases can exit properly
tree fndecl = fnctx.fndecl;
- Location end_label_locus = expr.get_locus (); // FIXME
+ location_t end_label_locus = expr.get_locus (); // FIXME
tree end_label
= ctx->get_backend ()->label (fndecl,
"" /* empty creates an artificial label */,
= ctx->get_backend ()->label_definition_statement (end_label);
// setup the switch-body-block
- Location start_location = UNKNOWN_LOCATION; // FIXME
- Location end_location = UNKNOWN_LOCATION; // FIXME
+ location_t start_location = UNKNOWN_LOCATION; // FIXME
+ location_t end_location = UNKNOWN_LOCATION; // FIXME
tree switch_body_block
= ctx->get_backend ()->block (fndecl, enclosing_scope, {}, start_location,
end_location);
rust_assert (kase_arm.get_patterns ().size () > 0);
// generate implicit label
- Location arm_locus = kase_arm.get_locus ();
+ location_t arm_locus = kase_arm.get_locus ();
tree case_label = ctx->get_backend ()->label (
fndecl, "" /* empty creates an artificial label */, arm_locus);
rust_assert (ok);
// coerce it if required
- Location lvalue_locus
+ location_t lvalue_locus
= ctx->get_mappings ()->lookup_location (expected->get_ty_ref ());
- Location rvalue_locus = argument->get_locus ();
+ location_t rvalue_locus = argument->get_locus ();
rvalue
= coercion_site (argument->get_mappings ().get_hirid (), rvalue,
actual, expected, lvalue_locus, rvalue_locus);
rust_assert (ok);
// coerce it if required
- Location lvalue_locus
+ location_t lvalue_locus
= ctx->get_mappings ()->lookup_location (expected->get_ty_ref ());
- Location rvalue_locus = argument->get_locus ();
+ location_t rvalue_locus = argument->get_locus ();
rvalue = coercion_site (argument->get_mappings ().get_hirid (), rvalue,
actual, expected, lvalue_locus, rvalue_locus);
rust_assert (ok);
// coerce it if required
- Location lvalue_locus
+ location_t lvalue_locus
= ctx->get_mappings ()->lookup_location (expected->get_ty_ref ());
- Location rvalue_locus = argument->get_locus ();
+ location_t rvalue_locus = argument->get_locus ();
rvalue = coercion_site (argument->get_mappings ().get_hirid (), rvalue,
actual, expected, lvalue_locus, rvalue_locus);
CompileExpr::get_fn_addr_from_dyn (const TyTy::DynamicObjectType *dyn,
TyTy::BaseType *receiver,
TyTy::FnType *fntype, tree receiver_ref,
- Location expr_locus)
+ location_t expr_locus)
{
size_t offs = 0;
const Resolver::TraitItemReference *ref = nullptr;
CompileExpr::get_receiver_from_dyn (const TyTy::DynamicObjectType *dyn,
TyTy::BaseType *receiver,
TyTy::FnType *fntype, tree receiver_ref,
- Location expr_locus)
+ location_t expr_locus)
{
// access the offs + 1 for the fnptr and offs=0 for the reciever obj
return ctx->get_backend ()->struct_field_expression (receiver_ref, 0,
}
tree
-CompileExpr::array_value_expr (Location expr_locus,
+CompileExpr::array_value_expr (location_t expr_locus,
const TyTy::ArrayType &array_tyty,
tree array_type, HIR::ArrayElemsValues &elems)
{
}
tree
-CompileExpr::array_copied_expr (Location expr_locus,
+CompileExpr::array_copied_expr (location_t expr_locus,
const TyTy::ArrayType &array_tyty,
tree array_type, HIR::ArrayElemsCopied &elems)
{
Resolver::Adjustment &adjustment, tree expression, location_t locus)
{
tree rvalue = expression;
- Location rvalue_locus = locus;
+ location_t rvalue_locus = locus;
const TyTy::BaseType *actual = adjustment.get_actual ();
const TyTy::BaseType *expected = adjustment.get_expected ();
}
tree enclosing_scope = NULL_TREE;
- Location start_location = function_body->get_locus ();
- Location end_location = function_body->get_locus ();
+ location_t start_location = function_body->get_locus ();
+ location_t end_location = function_body->get_locus ();
if (is_block_expr)
{
HIR::BlockExpr *body = static_cast<HIR::BlockExpr *> (function_body);
protected:
tree get_fn_addr_from_dyn (const TyTy::DynamicObjectType *dyn,
TyTy::BaseType *receiver, TyTy::FnType *fntype,
- tree receiver_ref, Location expr_locus);
+ tree receiver_ref, location_t expr_locus);
tree get_receiver_from_dyn (const TyTy::DynamicObjectType *dyn,
TyTy::BaseType *receiver, TyTy::FnType *fntype,
- tree receiver_ref, Location expr_locus);
+ tree receiver_ref, location_t expr_locus);
tree
resolve_operator_overload (Analysis::RustLangItem::ItemType lang_item_type,
tree type_cast_expression (tree type_to_cast_to, tree expr, location_t locus);
- tree array_value_expr (Location expr_locus, const TyTy::ArrayType &array_tyty,
- tree array_type, HIR::ArrayElemsValues &elems);
+ tree array_value_expr (location_t expr_locus,
+ const TyTy::ArrayType &array_tyty, tree array_type,
+ HIR::ArrayElemsValues &elems);
- tree array_copied_expr (Location expr_locus,
+ tree array_copied_expr (location_t expr_locus,
const TyTy::ArrayType &array_tyty, tree array_type,
HIR::ArrayElemsCopied &elems);
static tree compile (HIR::ExternalItem *item, Context *ctx,
TyTy::BaseType *concrete = nullptr,
bool is_query_mode = false,
- Location ref_locus = UNDEF_LOCATION)
+ location_t ref_locus = UNDEF_LOCATION)
{
CompileExternItem compiler (ctx, concrete, ref_locus);
item->accept_vis (compiler);
}
private:
- CompileExternItem (Context *ctx, TyTy::BaseType *concrete, Location ref_locus)
+ CompileExternItem (Context *ctx, TyTy::BaseType *concrete,
+ location_t ref_locus)
: HIRCompileBase (ctx), concrete (concrete), reference (error_mark_node),
ref_locus (ref_locus)
{}
TyTy::BaseType *concrete;
tree reference;
- Location ref_locus;
+ location_t ref_locus;
};
} // namespace Compile
static tree Compile (HIR::ImplItem *item, Context *ctx,
TyTy::BaseType *concrete = nullptr,
bool is_query_mode = false,
- Location ref_locus = UNDEF_LOCATION)
+ location_t ref_locus = UNDEF_LOCATION)
{
CompileInherentImplItem compiler (ctx, concrete, ref_locus);
item->accept_vis (compiler);
private:
CompileInherentImplItem (Context *ctx, TyTy::BaseType *concrete,
- Location ref_locus)
+ location_t ref_locus)
: CompileItem (ctx, concrete, ref_locus)
{}
};
public:
static tree Compile (HIR::TraitItem *item, Context *ctx,
TyTy::BaseType *concrete, bool is_query_mode = false,
- Location ref_locus = UNDEF_LOCATION)
+ location_t ref_locus = UNDEF_LOCATION)
{
CompileTraitItem compiler (ctx, concrete, ref_locus);
item->accept_vis (compiler);
void visit (HIR::TraitItemType &typ) override {}
private:
- CompileTraitItem (Context *ctx, TyTy::BaseType *concrete, Location ref_locus)
+ CompileTraitItem (Context *ctx, TyTy::BaseType *concrete,
+ location_t ref_locus)
: HIRCompileBase (ctx), concrete (concrete), reference (error_mark_node),
ref_locus (ref_locus)
{}
TyTy::BaseType *concrete;
tree reference;
- Location ref_locus;
+ location_t ref_locus;
};
} // namespace Compile
auto ¶m_tyty = parm.second;
auto compiled_param_type = TyTyResolveCompile::compile (ctx, param_tyty);
- Location param_locus = referenced_param->get_locus ();
+ location_t param_locus = referenced_param->get_locus ();
Bvariable *compiled_param_var
= CompileFnParam::compile (ctx, fndecl, referenced_param,
compiled_param_type, param_locus);
enter_intrinsic_block (Context *ctx, tree fndecl)
{
tree enclosing_scope = NULL_TREE;
- Location start_location = UNDEF_LOCATION;
- Location end_location = UNDEF_LOCATION;
+ location_t start_location = UNDEF_LOCATION;
+ location_t end_location = UNDEF_LOCATION;
auto block = ctx->get_backend ()->block (fndecl, enclosing_scope, {},
start_location, end_location);
static tree compile (HIR::Item *item, Context *ctx,
TyTy::BaseType *concrete = nullptr,
bool is_query_mode = false,
- Location ref_locus = UNDEF_LOCATION)
+ location_t ref_locus = UNDEF_LOCATION)
{
CompileItem compiler (ctx, concrete, ref_locus);
item->accept_vis (compiler);
void visit (HIR::ExprStmt &) override {}
protected:
- CompileItem (Context *ctx, TyTy::BaseType *concrete, Location ref_locus)
+ CompileItem (Context *ctx, TyTy::BaseType *concrete, location_t ref_locus)
: HIRCompileBase (ctx), concrete (concrete), reference (error_mark_node),
ref_locus (ref_locus)
{}
TyTy::BaseType *concrete;
tree reference;
- Location ref_locus;
+ location_t ref_locus;
};
} // namespace Compile
{
public:
static void Compile (HIR::Pattern *pattern, tree init_expr,
- TyTy::BaseType *ty, Location rval_locus, Context *ctx)
+ TyTy::BaseType *ty, location_t rval_locus, Context *ctx)
{
CompilePatternLet compiler (ctx, init_expr, ty, rval_locus);
pattern->accept_vis (compiler);
protected:
CompilePatternLet (Context *ctx, tree init_expr, TyTy::BaseType *ty,
- Location rval_locus)
+ location_t rval_locus)
: HIRCompileBase (ctx), init_expr (init_expr), ty (ty),
rval_locus (rval_locus)
{}
tree init_expr;
TyTy::BaseType *ty;
- Location rval_locus;
+ location_t rval_locus;
};
} // namespace Compile
tree
ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment,
const Analysis::NodeMapping &mappings,
- Location expr_locus, bool is_qualified_path)
+ location_t expr_locus, bool is_qualified_path)
{
TyTy::BaseType *lookup = nullptr;
bool ok = ctx->get_tyctx ()->lookup_type (mappings.get_hirid (), &lookup);
HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup,
const HIR::PathIdentSegment &final_segment,
const Analysis::NodeMapping &mappings,
- Location expr_locus, bool is_qualified_path)
+ location_t expr_locus, bool is_qualified_path)
{
HIR::Item *resolved_item = ctx->get_mappings ()->lookup_hir_item (ref);
HirId parent_block;
stmt.get_init_expr ()->get_mappings ().get_hirid (), &actual);
rust_assert (ok);
- Location lvalue_locus = stmt.get_pattern ()->get_locus ();
- Location rvalue_locus = stmt.get_init_expr ()->get_locus ();
+ location_t lvalue_locus = stmt.get_pattern ()->get_locus ();
+ location_t rvalue_locus = stmt.get_init_expr ()->get_locus ();
TyTy::BaseType *expected = ty;
init = coercion_site (stmt.get_mappings ().get_hirid (), init, actual,
expected, lvalue_locus, rvalue_locus);
if (!should_be_void)
{
auto ret = TyTyResolveCompile::compile (ctx, hir_type, trait_object_mode);
- Location return_type_locus
+ location_t return_type_locus
= ctx->get_mappings ()->lookup_location (hir_type->get_ref ());
results.push_back (
Backend::typed_identifier ("_", ret, return_type_locus));
tree
HIRCompileBase::coercion_site (HirId id, tree rvalue, TyTy::BaseType *rval,
- TyTy::BaseType *lval, Location lvalue_locus,
- Location rvalue_locus)
+ TyTy::BaseType *lval, location_t lvalue_locus,
+ location_t rvalue_locus)
{
std::vector<Resolver::Adjustment> *adjustments = nullptr;
bool ok = ctx->get_tyctx ()->lookup_autoderef_mappings (id, &adjustments);
tree
HIRCompileBase::coercion_site1 (tree rvalue, TyTy::BaseType *rval,
- TyTy::BaseType *lval, Location lvalue_locus,
- Location rvalue_locus)
+ TyTy::BaseType *lval, location_t lvalue_locus,
+ location_t rvalue_locus)
{
if (rvalue == error_mark_node)
return error_mark_node;
bool
HIRCompileBase::verify_array_capacities (tree ltype, tree rtype,
- Location lvalue_locus,
- Location rvalue_locus)
+ location_t lvalue_locus,
+ location_t rvalue_locus)
{
rust_assert (ltype != NULL_TREE);
rust_assert (rtype != NULL_TREE);
// error ("invalid type for parameter %d of %<constexpr%> "
// "function %q+#D",
// DECL_PARM_INDEX (parm), fun);
- Location locus = DECL_SOURCE_LOCATION (fun);
+ location_t locus = DECL_SOURCE_LOCATION (fun);
rust_error_at (
locus, "invalid type for parameter %d of %<constexpr%> function",
DECL_PARM_INDEX (parm));