gccrs: Replace usages of Location with location_t in typechecking
gcc/rust/ChangeLog: * typecheck/rust-autoderef.cc: Replace Location with location_t. * typecheck/rust-coercion.cc: Likewise. * typecheck/rust-coercion.h: Likewise. * typecheck/rust-hir-path-probe.h: Likewise. * typecheck/rust-hir-trait-reference.cc: Likewise. * typecheck/rust-hir-trait-resolve.cc: Likewise. * typecheck/rust-hir-type-check-base.cc: Likewise. * typecheck/rust-hir-type-check-expr.cc: Likewise. * typecheck/rust-hir-type-check-expr.h: Likewise. * typecheck/rust-hir-type-check-implitem.cc: Likewise. * typecheck/rust-hir-type-check-item.cc: Likewise. * typecheck/rust-hir-type-check-path.cc: Likewise. * typecheck/rust-hir-type-check-pattern.cc: Likewise. * typecheck/rust-hir-type-check-stmt.cc: Likewise. * typecheck/rust-hir-type-check-struct.cc: Likewise. * typecheck/rust-hir-type-check-type.cc: Likewise. * typecheck/rust-hir-type-check-type.h: Likewise. * typecheck/rust-type-util.cc: Likewise. * typecheck/rust-type-util.h: Likewise. * typecheck/rust-tyty-bounds.cc: Likewise. * typecheck/rust-tyty-call.cc: Likewise. * typecheck/rust-tyty-call.h: Likewise. * typecheck/rust-tyty-cmp.h: Likewise. * typecheck/rust-tyty-subst.cc: Likewise. * typecheck/rust-tyty-subst.h: Likewise. * typecheck/rust-tyty.cc: Likewise.
This commit is contained in:
parent
55a3049525
commit
9cc353d75a
26 changed files with 130 additions and 127 deletions
|
@ -296,7 +296,7 @@ resolve_operator_overload_fn (
|
|||
rust_assert (lookup->get_kind () == TyTy::TypeKind::FNDEF);
|
||||
fn = static_cast<TyTy::FnType *> (lookup);
|
||||
|
||||
Location unify_locus = mappings->lookup_location (lhs->get_ref ());
|
||||
location_t unify_locus = mappings->lookup_location (lhs->get_ref ());
|
||||
unify_site (lhs->get_ref (),
|
||||
TyTy::TyWithLocation (fn->get_self_type ()),
|
||||
TyTy::TyWithLocation (adjusted_self), unify_locus);
|
||||
|
|
|
@ -116,8 +116,8 @@ TypeCoercionRules::do_coercion (TyTy::BaseType *receiver)
|
|||
}
|
||||
else if (unsafe_error)
|
||||
{
|
||||
// Location lhs = mappings->lookup_location (receiver->get_ref ());
|
||||
// Location rhs = mappings->lookup_location (expected->get_ref ());
|
||||
// location_t lhs = mappings->lookup_location (receiver->get_ref ());
|
||||
// location_t rhs = mappings->lookup_location (expected->get_ref ());
|
||||
// object_unsafe_error (locus, lhs, rhs);
|
||||
return false;
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ TypeCoercionRules::coerce_unsafe_ptr (TyTy::BaseType *receiver,
|
|||
|
||||
if (!coerceable_mutability (from_mutbl, to_mutbl))
|
||||
{
|
||||
Location lhs = mappings->lookup_location (receiver->get_ref ());
|
||||
Location rhs = mappings->lookup_location (expected->get_ref ());
|
||||
location_t lhs = mappings->lookup_location (receiver->get_ref ());
|
||||
location_t rhs = mappings->lookup_location (expected->get_ref ());
|
||||
mismatched_mutability_error (locus, lhs, rhs);
|
||||
return TypeCoercionRules::CoercionResult::get_error ();
|
||||
}
|
||||
|
@ -294,8 +294,8 @@ TypeCoercionRules::coerce_borrowed_pointer (TyTy::BaseType *receiver,
|
|||
|
||||
if (!coerceable_mutability (from_mutbl, to_mutbl))
|
||||
{
|
||||
Location lhs = mappings->lookup_location (receiver->get_ref ());
|
||||
Location rhs = mappings->lookup_location (expected->get_ref ());
|
||||
location_t lhs = mappings->lookup_location (receiver->get_ref ());
|
||||
location_t rhs = mappings->lookup_location (expected->get_ref ());
|
||||
mismatched_mutability_error (locus, lhs, rhs);
|
||||
return TypeCoercionRules::CoercionResult::get_error ();
|
||||
}
|
||||
|
@ -339,8 +339,8 @@ TypeCoercionRules::coerce_unsized (TyTy::BaseType *source,
|
|||
if (!coerceable_mutability (from_mutbl, to_mutbl))
|
||||
{
|
||||
unsafe_error = true;
|
||||
Location lhs = mappings->lookup_location (source->get_ref ());
|
||||
Location rhs = mappings->lookup_location (target->get_ref ());
|
||||
location_t lhs = mappings->lookup_location (source->get_ref ());
|
||||
location_t rhs = mappings->lookup_location (target->get_ref ());
|
||||
mismatched_mutability_error (locus, lhs, rhs);
|
||||
return TypeCoercionRules::CoercionResult::get_error ();
|
||||
}
|
||||
|
@ -364,8 +364,8 @@ TypeCoercionRules::coerce_unsized (TyTy::BaseType *source,
|
|||
if (!coerceable_mutability (from_mutbl, to_mutbl))
|
||||
{
|
||||
unsafe_error = true;
|
||||
Location lhs = mappings->lookup_location (source->get_ref ());
|
||||
Location rhs = mappings->lookup_location (target->get_ref ());
|
||||
location_t lhs = mappings->lookup_location (source->get_ref ());
|
||||
location_t rhs = mappings->lookup_location (target->get_ref ());
|
||||
mismatched_mutability_error (locus, lhs, rhs);
|
||||
return TypeCoercionRules::CoercionResult::get_error ();
|
||||
}
|
||||
|
@ -459,8 +459,8 @@ TypeCoercionRules::coerceable_mutability (Mutability from_mutbl,
|
|||
}
|
||||
|
||||
void
|
||||
TypeCoercionRules::mismatched_mutability_error (Location expr_locus,
|
||||
Location lhs, Location rhs)
|
||||
TypeCoercionRules::mismatched_mutability_error (location_t expr_locus,
|
||||
location_t lhs, location_t rhs)
|
||||
{
|
||||
if (!emit_errors)
|
||||
return;
|
||||
|
@ -472,8 +472,8 @@ TypeCoercionRules::mismatched_mutability_error (Location expr_locus,
|
|||
}
|
||||
|
||||
void
|
||||
TypeCoercionRules::object_unsafe_error (Location expr_locus, Location lhs,
|
||||
Location rhs)
|
||||
TypeCoercionRules::object_unsafe_error (location_t expr_locus, location_t lhs,
|
||||
location_t rhs)
|
||||
{
|
||||
if (!emit_errors)
|
||||
return;
|
||||
|
|
|
@ -65,9 +65,10 @@ public:
|
|||
static bool coerceable_mutability (Mutability from_mutbl,
|
||||
Mutability to_mutbl);
|
||||
|
||||
void mismatched_mutability_error (Location expr_locus, Location lhs,
|
||||
Location rhs);
|
||||
void object_unsafe_error (Location expr_locus, Location lhs, Location rhs);
|
||||
void mismatched_mutability_error (location_t expr_locus, location_t lhs,
|
||||
location_t rhs);
|
||||
void object_unsafe_error (location_t expr_locus, location_t lhs,
|
||||
location_t rhs);
|
||||
|
||||
protected:
|
||||
TypeCoercionRules (TyTy::BaseType *expected, location_t locus,
|
||||
|
|
|
@ -158,7 +158,8 @@ class ReportMultipleCandidateError : private TypeCheckBase
|
|||
{
|
||||
public:
|
||||
static void Report (std::set<PathProbeCandidate> &candidates,
|
||||
const HIR::PathIdentSegment &query, Location query_locus)
|
||||
const HIR::PathIdentSegment &query,
|
||||
location_t query_locus)
|
||||
{
|
||||
rich_location r (line_table, query_locus);
|
||||
for (auto &c : candidates)
|
||||
|
|
|
@ -57,7 +57,7 @@ TraitItemReference::get_hir_trait_item () const
|
|||
return hir_trait_item;
|
||||
}
|
||||
|
||||
Location
|
||||
location_t
|
||||
TraitItemReference::get_locus () const
|
||||
{
|
||||
return locus;
|
||||
|
@ -148,7 +148,7 @@ TraitReference::is_error () const
|
|||
return hir_trait_ref == nullptr;
|
||||
}
|
||||
|
||||
Location
|
||||
location_t
|
||||
TraitReference::get_locus () const
|
||||
{
|
||||
return hir_trait_ref->get_locus ();
|
||||
|
|
|
@ -349,7 +349,7 @@ TraitItemReference::resolve_item (HIR::TraitItemFunc &func)
|
|||
|
||||
auto block_expr_ty = TypeCheckExpr::Resolve (func.get_block_expr ().get ());
|
||||
|
||||
Location fn_return_locus
|
||||
location_t fn_return_locus
|
||||
= func.get_decl ().has_return_type ()
|
||||
? func.get_decl ().get_return_type ()->get_locus ()
|
||||
: func.get_locus ();
|
||||
|
|
|
@ -44,7 +44,7 @@ TypeCheckBase::check_for_unconstrained (
|
|||
return check_result;
|
||||
|
||||
std::set<HirId> symbols_to_constrain;
|
||||
std::map<HirId, Location> symbol_to_location;
|
||||
std::map<HirId, location_t> symbol_to_location;
|
||||
for (const auto &p : params_to_constrain)
|
||||
{
|
||||
HirId ref = p.get_param_ty ()->get_ref ();
|
||||
|
|
|
@ -151,8 +151,9 @@ void
|
|||
TypeCheckExpr::visit (HIR::ReturnExpr &expr)
|
||||
{
|
||||
auto fn_return_tyty = context->peek_return_type ();
|
||||
Location expr_locus = expr.has_return_expr () ? expr.get_expr ()->get_locus ()
|
||||
: expr.get_locus ();
|
||||
location_t expr_locus = expr.has_return_expr ()
|
||||
? expr.get_expr ()->get_locus ()
|
||||
: expr.get_locus ();
|
||||
TyTy::BaseType *expr_ty
|
||||
= expr.has_return_expr ()
|
||||
? TypeCheckExpr::Resolve (expr.get_expr ().get ())
|
||||
|
@ -1503,9 +1504,9 @@ TypeCheckExpr::visit (HIR::ClosureExpr &expr)
|
|||
parameter_types);
|
||||
context->insert_implicit_type (closure_args);
|
||||
|
||||
Location result_type_locus = expr.has_return_type ()
|
||||
? expr.get_return_type ()->get_locus ()
|
||||
: expr.get_locus ();
|
||||
location_t result_type_locus = expr.has_return_type ()
|
||||
? expr.get_return_type ()->get_locus ()
|
||||
: expr.get_locus ();
|
||||
TyTy::TyVar result_type
|
||||
= expr.has_return_type ()
|
||||
? TyTy::TyVar (
|
||||
|
@ -1513,7 +1514,7 @@ TypeCheckExpr::visit (HIR::ClosureExpr &expr)
|
|||
: TyTy::TyVar::get_implicit_infer_var (expr.get_locus ());
|
||||
|
||||
// resolve the block
|
||||
Location closure_expr_locus = expr.get_expr ()->get_locus ();
|
||||
location_t closure_expr_locus = expr.get_expr ()->get_locus ();
|
||||
TyTy::BaseType *closure_expr_ty
|
||||
= TypeCheckExpr::Resolve (expr.get_expr ().get ());
|
||||
coercion_site (expr.get_mappings ().get_hirid (),
|
||||
|
|
|
@ -118,7 +118,7 @@ private:
|
|||
std::vector<HIR::PathExprSegment> &segments,
|
||||
size_t offset, TyTy::BaseType *tyseg,
|
||||
const Analysis::NodeMapping &expr_mappings,
|
||||
Location expr_locus);
|
||||
location_t expr_locus);
|
||||
|
||||
bool
|
||||
validate_arithmetic_type (const TyTy::BaseType *tyty,
|
||||
|
|
|
@ -317,9 +317,9 @@ TypeCheckImplItem::visit (HIR::Function &function)
|
|||
auto block_expr_ty
|
||||
= TypeCheckExpr::Resolve (function.get_definition ().get ());
|
||||
|
||||
Location fn_return_locus = function.has_function_return_type ()
|
||||
? function.get_return_type ()->get_locus ()
|
||||
: function.get_locus ();
|
||||
location_t fn_return_locus = function.has_function_return_type ()
|
||||
? function.get_return_type ()->get_locus ()
|
||||
: function.get_locus ();
|
||||
|
||||
coercion_site (function.get_definition ()->get_mappings ().get_hirid (),
|
||||
TyTy::TyWithLocation (expected_ret_tyty, fn_return_locus),
|
||||
|
|
|
@ -495,9 +495,9 @@ TypeCheckItem::visit (HIR::Function &function)
|
|||
auto block_expr_ty
|
||||
= TypeCheckExpr::Resolve (function.get_definition ().get ());
|
||||
|
||||
Location fn_return_locus = function.has_function_return_type ()
|
||||
? function.get_return_type ()->get_locus ()
|
||||
: function.get_locus ();
|
||||
location_t fn_return_locus = function.has_function_return_type ()
|
||||
? function.get_return_type ()->get_locus ()
|
||||
: function.get_locus ();
|
||||
coercion_site (function.get_definition ()->get_mappings ().get_hirid (),
|
||||
TyTy::TyWithLocation (expected_ret_tyty, fn_return_locus),
|
||||
TyTy::TyWithLocation (block_expr_ty),
|
||||
|
|
|
@ -320,7 +320,7 @@ TypeCheckExpr::resolve_segments (NodeId root_resolved_node_id,
|
|||
std::vector<HIR::PathExprSegment> &segments,
|
||||
size_t offset, TyTy::BaseType *tyseg,
|
||||
const Analysis::NodeMapping &expr_mappings,
|
||||
Location expr_locus)
|
||||
location_t expr_locus)
|
||||
{
|
||||
NodeId resolved_node_id = root_resolved_node_id;
|
||||
TyTy::BaseType *prev_segment = tyseg;
|
||||
|
|
|
@ -140,7 +140,7 @@ TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)
|
|||
}
|
||||
|
||||
void
|
||||
emit_invalid_field_error (Location loc, Rust::TyTy::VariantDef *variant,
|
||||
emit_invalid_field_error (location_t loc, Rust::TyTy::VariantDef *variant,
|
||||
const std::string &name)
|
||||
{
|
||||
rust_error_at (loc, ErrorCode::E0026,
|
||||
|
|
|
@ -78,7 +78,7 @@ TypeCheckStmt::visit (HIR::LetStmt &stmt)
|
|||
|
||||
HIR::Pattern &stmt_pattern = *stmt.get_pattern ();
|
||||
TyTy::BaseType *init_expr_ty = nullptr;
|
||||
Location init_expr_locus = UNKNOWN_LOCATION;
|
||||
location_t init_expr_locus = UNKNOWN_LOCATION;
|
||||
if (stmt.has_init_expr ())
|
||||
{
|
||||
init_expr_locus = stmt.get_init_expr ()->get_locus ();
|
||||
|
@ -91,7 +91,7 @@ TypeCheckStmt::visit (HIR::LetStmt &stmt)
|
|||
}
|
||||
|
||||
TyTy::BaseType *specified_ty = nullptr;
|
||||
Location specified_ty_locus;
|
||||
location_t specified_ty_locus;
|
||||
if (stmt.has_type ())
|
||||
{
|
||||
specified_ty = TypeCheckType::Resolve (stmt.get_type ().get ());
|
||||
|
|
|
@ -259,7 +259,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIdentifierValue &field)
|
|||
}
|
||||
|
||||
TyTy::BaseType *value = TypeCheckExpr::Resolve (field.get_value ().get ());
|
||||
Location value_locus = field.get_value ()->get_locus ();
|
||||
location_t value_locus = field.get_value ()->get_locus ();
|
||||
|
||||
HirId coercion_site_id = field.get_mappings ().get_hirid ();
|
||||
resolved_field_value_expr
|
||||
|
@ -296,7 +296,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIndexValue &field)
|
|||
}
|
||||
|
||||
TyTy::BaseType *value = TypeCheckExpr::Resolve (field.get_value ().get ());
|
||||
Location value_locus = field.get_value ()->get_locus ();
|
||||
location_t value_locus = field.get_value ()->get_locus ();
|
||||
|
||||
HirId coercion_site_id = field.get_mappings ().get_hirid ();
|
||||
resolved_field_value_expr
|
||||
|
@ -343,7 +343,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIdentifier &field)
|
|||
HIR::PathInExpression expr (mappings_copy2, {seg}, field.get_locus (), false,
|
||||
{});
|
||||
TyTy::BaseType *value = TypeCheckExpr::Resolve (&expr);
|
||||
Location value_locus = expr.get_locus ();
|
||||
location_t value_locus = expr.get_locus ();
|
||||
|
||||
HirId coercion_site_id = field.get_mappings ().get_hirid ();
|
||||
resolved_field_value_expr
|
||||
|
|
|
@ -450,7 +450,7 @@ TypeCheckType::resolve_segments (
|
|||
NodeId root_resolved_node_id, HirId expr_id,
|
||||
std::vector<std::unique_ptr<HIR::TypePathSegment>> &segments, size_t offset,
|
||||
TyTy::BaseType *tyseg, const Analysis::NodeMapping &expr_mappings,
|
||||
Location expr_locus)
|
||||
location_t expr_locus)
|
||||
{
|
||||
NodeId resolved_node_id = root_resolved_node_id;
|
||||
TyTy::BaseType *prev_segment = tyseg;
|
||||
|
|
|
@ -88,7 +88,7 @@ private:
|
|||
NodeId root_resolved_node_id, HirId expr_id,
|
||||
std::vector<std::unique_ptr<HIR::TypePathSegment>> &segments, size_t offset,
|
||||
TyTy::BaseType *tyseg, const Analysis::NodeMapping &expr_mappings,
|
||||
Location expr_locus);
|
||||
location_t expr_locus);
|
||||
|
||||
TyTy::BaseType *translated;
|
||||
};
|
||||
|
|
|
@ -115,7 +115,7 @@ query_type (HirId reference, TyTy::BaseType **result)
|
|||
}
|
||||
|
||||
// more?
|
||||
Location possible_locus = mappings->lookup_location (reference);
|
||||
location_t possible_locus = mappings->lookup_location (reference);
|
||||
rust_debug_loc (possible_locus, "query system failed to resolve: [%u]",
|
||||
reference);
|
||||
context->query_completed (reference);
|
||||
|
@ -125,7 +125,7 @@ query_type (HirId reference, TyTy::BaseType **result)
|
|||
|
||||
bool
|
||||
types_compatable (TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
|
||||
Location unify_locus, bool emit_errors)
|
||||
location_t unify_locus, bool emit_errors)
|
||||
{
|
||||
TyTy::BaseType *result
|
||||
= unify_site_and (UNKNOWN_HIRID, lhs, rhs, unify_locus, emit_errors,
|
||||
|
@ -135,7 +135,7 @@ types_compatable (TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
|
|||
|
||||
TyTy::BaseType *
|
||||
unify_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
|
||||
Location unify_locus)
|
||||
location_t unify_locus)
|
||||
{
|
||||
TyTy::BaseType *expected = lhs.get_ty ();
|
||||
TyTy::BaseType *expr = rhs.get_ty ();
|
||||
|
@ -152,7 +152,7 @@ unify_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
|
|||
|
||||
TyTy::BaseType *
|
||||
unify_site_and (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
|
||||
Location unify_locus, bool emit_errors, bool commit_if_ok,
|
||||
location_t unify_locus, bool emit_errors, bool commit_if_ok,
|
||||
bool implicit_infer_vars, bool cleanup)
|
||||
{
|
||||
TypeCheckContext &context = *TypeCheckContext::get ();
|
||||
|
@ -251,7 +251,7 @@ try_coercion (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
|
|||
|
||||
TyTy::BaseType *
|
||||
cast_site (HirId id, TyTy::TyWithLocation from, TyTy::TyWithLocation to,
|
||||
Location cast_locus)
|
||||
location_t cast_locus)
|
||||
{
|
||||
rust_debug ("cast_site id={%u} from={%s} to={%s}", id,
|
||||
from.get_ty ()->debug_str ().c_str (),
|
||||
|
|
|
@ -30,28 +30,28 @@ query_type (HirId reference, TyTy::BaseType **result);
|
|||
|
||||
bool
|
||||
types_compatable (TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
|
||||
Location unify_locus, bool emit_errors);
|
||||
location_t unify_locus, bool emit_errors);
|
||||
|
||||
TyTy::BaseType *
|
||||
unify_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
|
||||
Location unify_locus);
|
||||
location_t unify_locus);
|
||||
|
||||
TyTy::BaseType *
|
||||
unify_site_and (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
|
||||
Location unify_locus, bool emit_errors, bool commit_if_ok,
|
||||
location_t unify_locus, bool emit_errors, bool commit_if_ok,
|
||||
bool implicit_infer_vars, bool cleanup);
|
||||
|
||||
TyTy::BaseType *
|
||||
coercion_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
|
||||
Location coercion_locus);
|
||||
location_t coercion_locus);
|
||||
|
||||
TyTy::BaseType *
|
||||
try_coercion (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
|
||||
Location coercion_locus);
|
||||
location_t coercion_locus);
|
||||
|
||||
TyTy::BaseType *
|
||||
cast_site (HirId id, TyTy::TyWithLocation from, TyTy::TyWithLocation to,
|
||||
Location cast_locus);
|
||||
location_t cast_locus);
|
||||
|
||||
AssociatedImplTrait *
|
||||
lookup_associated_impl_block (const TyTy::TypeBoundPredicate &bound,
|
||||
|
|
|
@ -236,7 +236,7 @@ TypeCheckBase::get_predicate_from_bound (HIR::TypePath &type_path,
|
|||
Analysis::RustLangItem::ItemType::FN_ONCE_OUTPUT);
|
||||
|
||||
std::vector<HIR::GenericArgsBinding> bindings;
|
||||
Location output_locus = fn.get_return_type ()->get_locus ();
|
||||
location_t output_locus = fn.get_return_type ()->get_locus ();
|
||||
HIR::GenericArgsBinding binding (Identifier (
|
||||
trait_item->trait_identifier ()),
|
||||
fn.get_return_type ()->clone_type (),
|
||||
|
@ -732,7 +732,7 @@ TypeBoundPredicateItem::needs_implementation () const
|
|||
return !get_raw_item ()->is_optional ();
|
||||
}
|
||||
|
||||
Location
|
||||
location_t
|
||||
TypeBoundPredicateItem::get_locus () const
|
||||
{
|
||||
return get_raw_item ()->get_locus ();
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Rust {
|
|||
namespace TyTy {
|
||||
|
||||
void
|
||||
emit_unexpected_argument_error (Location loc,
|
||||
emit_unexpected_argument_error (location_t loc,
|
||||
unsigned long unexpected_arg_count,
|
||||
unsigned long expected_arg_count)
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ TypeCheckCallExpr::visit (ADTType &type)
|
|||
{
|
||||
StructFieldType *field = variant.get_field_at_index (i);
|
||||
BaseType *field_tyty = field->get_field_type ();
|
||||
Location arg_locus = argument->get_locus ();
|
||||
location_t arg_locus = argument->get_locus ();
|
||||
|
||||
BaseType *arg = Resolver::TypeCheckExpr::Resolve (argument.get ());
|
||||
if (arg->get_kind () == TyTy::TypeKind::ERROR)
|
||||
|
@ -138,7 +138,7 @@ TypeCheckCallExpr::visit (FnType &type)
|
|||
size_t i = 0;
|
||||
for (auto &argument : call.get_arguments ())
|
||||
{
|
||||
Location arg_locus = argument->get_locus ();
|
||||
location_t arg_locus = argument->get_locus ();
|
||||
auto argument_expr_tyty
|
||||
= Resolver::TypeCheckExpr::Resolve (argument.get ());
|
||||
if (argument_expr_tyty->get_kind () == TyTy::TypeKind::ERROR)
|
||||
|
@ -155,7 +155,7 @@ TypeCheckCallExpr::visit (FnType &type)
|
|||
auto fnparam = type.param_at (i);
|
||||
HIR::Pattern *fn_param_pattern = fnparam.first;
|
||||
BaseType *param_ty = fnparam.second;
|
||||
Location param_locus
|
||||
location_t param_locus
|
||||
= fn_param_pattern == nullptr
|
||||
? mappings->lookup_location (param_ty->get_ref ())
|
||||
: fn_param_pattern->get_locus ();
|
||||
|
@ -255,7 +255,7 @@ TypeCheckCallExpr::visit (FnPtr &type)
|
|||
size_t i = 0;
|
||||
for (auto &argument : call.get_arguments ())
|
||||
{
|
||||
Location arg_locus = argument->get_locus ();
|
||||
location_t arg_locus = argument->get_locus ();
|
||||
BaseType *fnparam = type.param_at (i);
|
||||
auto argument_expr_tyty
|
||||
= Resolver::TypeCheckExpr::Resolve (argument.get ());
|
||||
|
@ -292,8 +292,8 @@ TypeCheckCallExpr::visit (FnPtr &type)
|
|||
|
||||
TypeCheckMethodCallExpr::TypeCheckMethodCallExpr (
|
||||
Analysis::NodeMapping call_mappings, std::vector<Argument> &args,
|
||||
Location call_locus, Location receiver_locus, TyTy::BaseType *adjusted_self,
|
||||
Resolver::TypeCheckContext *context)
|
||||
location_t call_locus, location_t receiver_locus,
|
||||
TyTy::BaseType *adjusted_self, Resolver::TypeCheckContext *context)
|
||||
: call_mappings (call_mappings), arguments (args), call_locus (call_locus),
|
||||
receiver_locus (receiver_locus), adjusted_self (adjusted_self),
|
||||
context (context), mappings (Analysis::Mappings::get ())
|
||||
|
@ -329,8 +329,8 @@ TypeCheckMethodCallExpr::go (FnType *ref, HIR::MethodCallExpr &call,
|
|||
|
||||
BaseType *
|
||||
TypeCheckMethodCallExpr::go (FnType *ref, Analysis::NodeMapping call_mappings,
|
||||
std::vector<Argument> &args, Location call_locus,
|
||||
Location receiver_locus,
|
||||
std::vector<Argument> &args, location_t call_locus,
|
||||
location_t receiver_locus,
|
||||
TyTy::BaseType *adjusted_self,
|
||||
Resolver::TypeCheckContext *context)
|
||||
{
|
||||
|
@ -360,12 +360,12 @@ TypeCheckMethodCallExpr::check (FnType &type)
|
|||
size_t i = 1;
|
||||
for (auto &argument : arguments)
|
||||
{
|
||||
Location arg_locus = argument.get_locus ();
|
||||
location_t arg_locus = argument.get_locus ();
|
||||
|
||||
auto fnparam = type.param_at (i);
|
||||
HIR::Pattern *fn_param_pattern = fnparam.first;
|
||||
BaseType *param_ty = fnparam.second;
|
||||
Location param_locus
|
||||
location_t param_locus
|
||||
= fn_param_pattern == nullptr
|
||||
? mappings->lookup_location (param_ty->get_ref ())
|
||||
: fn_param_pattern->get_locus ();
|
||||
|
|
|
@ -112,23 +112,23 @@ public:
|
|||
Resolver::TypeCheckContext *context);
|
||||
|
||||
static BaseType *go (FnType *ref, Analysis::NodeMapping call_mappings,
|
||||
std::vector<Argument> &args, Location call_locus,
|
||||
Location receiver_locus, TyTy::BaseType *adjusted_self,
|
||||
std::vector<Argument> &args, location_t call_locus,
|
||||
location_t receiver_locus, TyTy::BaseType *adjusted_self,
|
||||
Resolver::TypeCheckContext *context);
|
||||
|
||||
protected:
|
||||
BaseType *check (FnType &type);
|
||||
|
||||
TypeCheckMethodCallExpr (Analysis::NodeMapping call_mappings,
|
||||
std::vector<Argument> &args, Location call_locus,
|
||||
Location receiver_locus,
|
||||
std::vector<Argument> &args, location_t call_locus,
|
||||
location_t receiver_locus,
|
||||
TyTy::BaseType *adjusted_self,
|
||||
Resolver::TypeCheckContext *context);
|
||||
|
||||
Analysis::NodeMapping call_mappings;
|
||||
std::vector<Argument> &arguments;
|
||||
Location call_locus;
|
||||
Location receiver_locus;
|
||||
location_t call_locus;
|
||||
location_t receiver_locus;
|
||||
TyTy::BaseType *adjusted_self;
|
||||
Resolver::TypeCheckContext *context;
|
||||
Analysis::Mappings *mappings;
|
||||
|
|
|
@ -62,8 +62,8 @@ public:
|
|||
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -78,8 +78,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -94,8 +94,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -110,8 +110,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -126,8 +126,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -142,8 +142,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -158,8 +158,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -174,8 +174,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -190,8 +190,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -206,8 +206,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -222,8 +222,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -238,8 +238,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -254,8 +254,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -270,8 +270,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -286,8 +286,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -302,8 +302,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -318,8 +318,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -334,8 +334,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -350,8 +350,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -366,8 +366,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -388,8 +388,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -404,8 +404,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -420,8 +420,8 @@ public:
|
|||
ok = false;
|
||||
if (emit_error_flag)
|
||||
{
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
Location base_locus
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t base_locus
|
||||
= mappings->lookup_location (get_base ()->get_ref ());
|
||||
rich_location r (line_table, ref_locus);
|
||||
r.add_range (base_locus);
|
||||
|
@ -1561,7 +1561,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
Location ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
location_t ref_locus = mappings->lookup_location (type.get_ref ());
|
||||
ok = base->bounds_compatible (type, ref_locus, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ SubstitutionParamMapping::needs_substitution () const
|
|||
return !(get_param_ty ()->is_concrete ());
|
||||
}
|
||||
|
||||
Location
|
||||
location_t
|
||||
SubstitutionParamMapping::get_param_locus () const
|
||||
{
|
||||
return generic.get_locus ();
|
||||
|
@ -333,7 +333,7 @@ SubstitutionArgumentMappings::is_concrete () const
|
|||
return true;
|
||||
}
|
||||
|
||||
Location
|
||||
location_t
|
||||
SubstitutionArgumentMappings::get_locus () const
|
||||
{
|
||||
return locus;
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
bool needs_substitution () const;
|
||||
|
||||
Location get_param_locus () const;
|
||||
location_t get_param_locus () const;
|
||||
|
||||
bool param_has_default_ty () const;
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ BaseType::get_ident () const
|
|||
return ident;
|
||||
}
|
||||
|
||||
Location
|
||||
location_t
|
||||
BaseType::get_locus () const
|
||||
{
|
||||
return ident.locus;
|
||||
|
@ -1349,7 +1349,7 @@ StructFieldType::debug () const
|
|||
rust_debug ("%s", as_string ().c_str ());
|
||||
}
|
||||
|
||||
Location
|
||||
location_t
|
||||
StructFieldType::get_locus () const
|
||||
{
|
||||
return locus;
|
||||
|
|
Loading…
Add table
Reference in a new issue